Windows下使用ffmpeg设置接收缓存区大小

andywong569 2017-05-05 10:22:11
在Windows中使用ffmpeg播放出现马赛克的问题,初步判断是接收缓存区设置小出现了丢包情况,于是我想直接改源代码,把unp.c中的 UDP_MAX_PKT_SIZE的值改成了 (65536*10),相当于放大了十倍,但是代码中使用的时候直接崩了,被迫无奈,看到有人说可以使用api来改这个缓冲区,下边是我的代码
av_register_all();
avformat_network_init();
AVFormatContext *pFormatCtx = avformat_alloc_context();

AVDictionary* options = nullptr;
int nRet = av_dict_set(&options, "bufsize", "655360", 0);
AVDictionaryEntry *t = NULL;
t = av_dict_get(options, "bufsize", NULL, AV_DICT_IGNORE_SUFFIX);
int nCount = av_dict_count(options);
if ((nRet = avformat_open_input(&pFormatCtx, "rtsp://192.168.99.51/1", NULL, &options)) != 0)
{
printf("打开输入流失败\n");
return;
}
nCount = av_dict_count(options);

if ((nRet = avformat_find_stream_info(pFormatCtx, &options)) < 0)
{
printf("查询流信息失败\n");
return;
}

但是,在avformat_find_stream_info(pFormatCtx, &options)这个地方崩了,

请大神帮忙分析下
...全文
5548 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
百灵工作室 2018-01-09
  • 打赏
  • 举报
回复
你改的是UDP的协议MTU包大小,改大了不仅于事无补,反而会变差,请尝试ffmpeg命令中rtbufsize的大小

1,451

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 图象工具使用
社区管理员
  • 图象工具使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧