From de478c09ecb018ad354dfc08d4bf2326dc500cba Mon Sep 17 00:00:00 2001 From: cbwu <504-wuchengbo@htsdfp.com> Date: Fri, 11 Oct 2024 10:12:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=8A=E8=88=B1?= =?UTF-8?q?=E6=8B=89=E7=A9=BA=E6=B5=81=E5=8D=A1=E4=BD=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/GDDC/gddcSet.cpp | 2 +- Src/Video/cffmpeg_decode.cpp | 12 ++++++------ global.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Src/GDDC/gddcSet.cpp b/Src/GDDC/gddcSet.cpp index 79a4e04..baa9473 100644 --- a/Src/GDDC/gddcSet.cpp +++ b/Src/GDDC/gddcSet.cpp @@ -41,7 +41,7 @@ void GDDCSet::initParam() { // ui->comboBox_streamType->addItem("UDP 422"); // ui->comboBox_streamType->addItem("UDP TS"); ui->comboBox_playURL1->addItem( - QStringLiteral("rtsp://192.168.55.65:554/live/track0")); + QStringLiteral("rtsp://10.90.10.132:554/live/track0")); ui->comboBox_playURL1->setCurrentIndex(0); // ui->comboBox_playURL1->addItem( // "rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid"); diff --git a/Src/Video/cffmpeg_decode.cpp b/Src/Video/cffmpeg_decode.cpp index a52cd72..ed3dda9 100644 --- a/Src/Video/cffmpeg_decode.cpp +++ b/Src/Video/cffmpeg_decode.cpp @@ -79,11 +79,13 @@ bool Cffmpeg_decode::open_input_file() { av_dict_set(&avdic, "buffer_size", "2048000", 0); // 设置超时断开连接时间,单位微秒//listen_timeout // av_dict_set(&avdic, "listen_timeout", "200000", 0); - av_dict_set(&avdic, "stimeout", "5000000", 0); // 设置超时5秒 + av_dict_set(&avdic, "stimeout", "3000000", 0); // 设置超时3秒 av_dict_set(&avdic, "max_delay", "300000", 0); // 设置最大时延300ms av_dict_set(&avdic, "tune", "zerolatency", 0); // 实时编码 av_dict_set(&avdic, "preset", "faster", 0); // ultrafast av_dict_set(&avdic, "threads", "auto", 0); // 自动开启线程数 + // 设置最大重试时间为1s,解决avformat_open_input打开空流时间过长问题 + av_dict_set(&avdic, "max_interleave_delta", "1000000", 0); // av_dict_set(&avdic, "rtsp_flags", "prefer_tcp", 0); // 保持TCP连接 // av_dict_set(&avdic, "timeout", "500000", 0); // 超时时间设置为500ms @@ -196,9 +198,9 @@ void Cffmpeg_decode::run() { // 推流使用 firstDts = AV_NOPTS_VALUE; // 初始化第一帧的DTS startTime = av_gettime(); - int ret11 = 0; + // 读取数据包 - while ((ret11 = av_read_frame(inputFormatCtx, inputPacket)) >= 0) { + while (av_read_frame(inputFormatCtx, inputPacket) >= 0) { // ret = av_read_frame(inputFormatCtx, inputPacket); // if (ret < 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { // qDebug() << "ret:" << QString::number(ret); @@ -314,9 +316,7 @@ void Cffmpeg_decode::run() { if (m_saveVideoFlag) { saveDone(); } - if (ret11 == AVERROR_EOF && errno == 0) { - qDebug() << "ret:"; - } + // QCoreApplication::processEvents(); qDebug() << "All video play done"; } diff --git a/global.cpp b/global.cpp index 97b3692..5e04fa5 100644 --- a/global.cpp +++ b/global.cpp @@ -2,7 +2,7 @@ global::global() {} -QString g_SoftwareVersion = "版本号:V1.0.0.1010"; +QString g_SoftwareVersion = "版本号:V1.0.0.1011"; QColor g_themeColor(51, 51, 51); QString g_PushBtnStyle = /**正常情况下样式**/