From 9db5b9f2779594de2d8f2077468d292df78d7a59 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Fri, 12 Nov 2021 14:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ffmpegdemo/ffmpeg/ffmpeg.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ffmpegdemo/ffmpeg/ffmpeg.cpp b/ffmpegdemo/ffmpeg/ffmpeg.cpp index 8499b1d..6a4f0ea 100644 --- a/ffmpegdemo/ffmpeg/ffmpeg.cpp +++ b/ffmpegdemo/ffmpeg/ffmpeg.cpp @@ -68,17 +68,17 @@ void FFmpegThread::initlib() bool FFmpegThread::init() { -// //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等 -// //设置缓存大小,1080p可将值调大 -// av_dict_set(&options, "buffer_size", "8192000", 0); -// //以tcp方式打开,如果以udp方式打开将tcp替换为udp -// av_dict_set(&options, "rtsp_transport", "tcp", 0); -// //设置超时断开连接时间,单位微秒,3000000表示3秒 -// av_dict_set(&options, "stimeout", "3000000", 0); -// //设置最大时延,单位微秒,1000000表示1秒 -// av_dict_set(&options, "max_delay", "1000000", 0); -// //自动开启线程数 -// av_dict_set(&options, "threads", "auto", 0); + //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等 + //设置缓存大小,1080p可将值调大 + av_dict_set(&options, "buffer_size", "8192000", 0); + //以tcp方式打开,如果以udp方式打开将tcp替换为udp + av_dict_set(&options, "rtsp_transport", "tcp", 0); + //设置超时断开连接时间,单位微秒,3000000表示3秒 + av_dict_set(&options, "stimeout", "3000000", 0); + //设置最大时延,单位微秒,1000000表示1秒 + av_dict_set(&options, "max_delay", "1000000", 0); + //自动开启线程数 + av_dict_set(&options, "threads", "auto", 0); //打开视频流 avFormatContext = avformat_alloc_context(); @@ -240,7 +240,6 @@ void FFmpegThread::run() } frameFinish = av_read_frame(avFormatContext, avPacket); - qDebug() << TIMEMS << frameFinish; if (frameFinish >= 0) { //判断当前包是视频还是音频 int index = avPacket->stream_index;