1. 推流rtsp到EasyDarwin的时候,如果断网了或EasyDarwin进程没启动则avformat_write_header会一直阻塞 然后线程会一直阻塞在avformat_write_header
解决方法: AVFormatContext设置中断回调,回调函数中判断avformat_write_header是否超时,超时则退出阻塞
由于设置了中断回调,故所有阻塞函数都要重置超时时间,否则这些函数会调用失败。
例如: 超时中断会导致av_interleaved_write_frame failed, ret: -32, Broken pipe 导致rtsp地址不能播放
常见的阻塞函数:
- avformat_open_input
- av_read_frame
- avformat_write_header
- av_write_trailer
- av_write_frame