更新代码

master
feiyangqingyun 2021-11-12 14:02:52 +08:00
parent ed740e2eef
commit 9db5b9f277
1 changed files with 11 additions and 12 deletions

View File

@ -68,17 +68,17 @@ void FFmpegThread::initlib()
bool FFmpegThread::init() bool FFmpegThread::init()
{ {
// //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等 //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等
// //设置缓存大小,1080p可将值调大 //设置缓存大小,1080p可将值调大
// av_dict_set(&options, "buffer_size", "8192000", 0); av_dict_set(&options, "buffer_size", "8192000", 0);
// //以tcp方式打开,如果以udp方式打开将tcp替换为udp //以tcp方式打开,如果以udp方式打开将tcp替换为udp
// av_dict_set(&options, "rtsp_transport", "tcp", 0); av_dict_set(&options, "rtsp_transport", "tcp", 0);
// //设置超时断开连接时间,单位微秒,3000000表示3秒 //设置超时断开连接时间,单位微秒,3000000表示3秒
// av_dict_set(&options, "stimeout", "3000000", 0); av_dict_set(&options, "stimeout", "3000000", 0);
// //设置最大时延,单位微秒,1000000表示1秒 //设置最大时延,单位微秒,1000000表示1秒
// av_dict_set(&options, "max_delay", "1000000", 0); av_dict_set(&options, "max_delay", "1000000", 0);
// //自动开启线程数 //自动开启线程数
// av_dict_set(&options, "threads", "auto", 0); av_dict_set(&options, "threads", "auto", 0);
//打开视频流 //打开视频流
avFormatContext = avformat_alloc_context(); avFormatContext = avformat_alloc_context();
@ -240,7 +240,6 @@ void FFmpegThread::run()
} }
frameFinish = av_read_frame(avFormatContext, avPacket); frameFinish = av_read_frame(avFormatContext, avPacket);
qDebug() << TIMEMS << frameFinish;
if (frameFinish >= 0) { if (frameFinish >= 0) {
//判断当前包是视频还是音频 //判断当前包是视频还是音频
int index = avPacket->stream_index; int index = avPacket->stream_index;