ffmpeg端口被占用

来源:互联网 发布:网络布线系统图 编辑:程序博客网 时间:2024/06/04 19:19


我们是用udp方式通信,正常关闭时功能使用正常,

但是断线重连时发生ffmpeg端口被占用,avformat_open_input返回-5,不知道为什么原因,


网上也米有资料,后来经过测试发现,avformat_open_input调用成功后,再调用一遍就会异常,


avformat_open_input 和avformat_close_input需要成对出现,

就是再断线重连时,先调用avformat_close_input,再调用avformat_open_input ,就不会发生端口被占用的情况了。

  if (avformat_open_input(&pFormatCtx, [moviePath UTF8String], NULL, &opts) != 0) {

1 0
原创粉丝点击