avformat_find_stream_info函数卡住问题
2015-05-04 11:50
1216 查看
问题:初始化RTSP流时,在android设备上卡住在avformat_find_stream_info函数,然后程序崩溃。
但其他URL没问题,且同样在代码在iOS上没问题,由于jni调试,也没看到ffmepg打印什么异常信息出来,而IOS上可以看到如下打印信息
[objc] view plaincopy
avformat_open_input ret= 0
UDP timeout, retrying with TCP
看到这个当时竟然没反应过来,知道看到参考链接说明才发现。
代码如下:
[objc] view plaincopy
av_register_all();
av_log_set_level(AV_LOG_DEBUG);
av_log_set_callback(log_callback);
avformat_network_init();
ret = avformat_open_input(&formatCtx, url, NULL, NULL);
NSLog(@" avformat_open_input ret= %d", ret);
if (ret < 0) {
NSLog(@" avformat_open_input error= %d", ret);
return ret ;
}
ret = avformat_find_stream_info(formatCtx, NULL);//在此卡住了,
NSLog(@" avformat_find_stream_info ret= %d", ret);
if (ret < 0) {
NSLog(@" avformat_find_stream_info error= %d", ret);
return ret;
}
解决方法:
指定为TCP传输。
[objc] view plaincopy
AVDictionary* options = NULL;
av_dict_set(&options, "rtsp_transport", "tcp", 0);
ret = avformat_open_input(&formatCtx, url, NULL, &options);
参考链接:
http://www.bkjia.com/IOSjc/874706.html
转载:http://blog.csdn.net/fb731666148/article/details/44408379
但其他URL没问题,且同样在代码在iOS上没问题,由于jni调试,也没看到ffmepg打印什么异常信息出来,而IOS上可以看到如下打印信息
[objc] view plaincopy
avformat_open_input ret= 0
UDP timeout, retrying with TCP
看到这个当时竟然没反应过来,知道看到参考链接说明才发现。
代码如下:
[objc] view plaincopy
av_register_all();
av_log_set_level(AV_LOG_DEBUG);
av_log_set_callback(log_callback);
avformat_network_init();
ret = avformat_open_input(&formatCtx, url, NULL, NULL);
NSLog(@" avformat_open_input ret= %d", ret);
if (ret < 0) {
NSLog(@" avformat_open_input error= %d", ret);
return ret ;
}
ret = avformat_find_stream_info(formatCtx, NULL);//在此卡住了,
NSLog(@" avformat_find_stream_info ret= %d", ret);
if (ret < 0) {
NSLog(@" avformat_find_stream_info error= %d", ret);
return ret;
}
解决方法:
指定为TCP传输。
[objc] view plaincopy
AVDictionary* options = NULL;
av_dict_set(&options, "rtsp_transport", "tcp", 0);
ret = avformat_open_input(&formatCtx, url, NULL, &options);
参考链接:
http://www.bkjia.com/IOSjc/874706.html
转载:http://blog.csdn.net/fb731666148/article/details/44408379
相关文章推荐
- avformat_find_stream_info函数卡住问题
- ffmpeg学习七:avformat_find_stream_info函数源码分析
- FFMPEG函数avformat_find_stream_info()
- 针对ffmpeg做rtsp客户端时,avformat_find_stream_info长时间等待问题
- FFmpeg函数简单分析:avformat_find_stream_info()
- 图解FFMPEG打开媒体的函数avformat_open_input&avformat_find_stream_info
- FFmpeg函数avformat_find_stream_info()
- FFmpeg avformat_find_stream_info函数优化
- FFMEPG函数avformat_find_stream_info作用
- ffmpeg, demux, avformt_find_stream_info,解决卡住的问题
- ffmpeg源码跟踪笔记之avformat_find_stream_info
- ffmpeg 视频解码 vformat_find_stream_info() 后获取视频分辨率错误问题
- 解决 ffmpeg 在avformat_find_stream_info执行时间太长
- ffmpeg源码分析--8.avformat_find_stream_info及一些参数的确定
- 解决 ffmpeg 在avformat_find_stream_info执行时间太长
- FFmpeg(4)-使用avformat_find_stream_info()来探测获取封装格式的上下文信息
- 解决 ffmpeg 在avformat_find_stream_info执行时间太长
- avformat_find_stream_info读数据时的几个缓存数据的流向
- VLC初始加载优化:avformat_find_stream_info接口延迟降低
- FFmpeg源代码简单分析:avformat_find_stream_info()