ffmpeg avformat_open_input返回失敗,錯誤碼-10049

ffmpeg avformat_open_input失敗,返回錯誤碼-10049,錯誤描述:Error number -10049 occurred

調試代碼,找到如果設置了time_out參數,就會失敗,不設置就沒問題,具體原因還沒有找到,備註此問題,以待後續繼續分析

源代碼:

av_register_all();
avformat_network_init();

AVFormatContext *pFormatCtx = avformat_alloc_context();
pFormatCtx->interrupt_callback.opaque = this;
pFormatCtx->interrupt_callback.callback = interrupt_cb;//設置超時回調函數

AVDictionary *optionsDict = NULL;
if(Rtsp_Protocol==TCP)
{
    av_dict_set(&optionsDict, "rtsp_transport", "tcp", 0);//採用tcp傳輸
}
av_dict_set(&optionsDict, "stimeout", "5000000", 0);//設置rtsp超時5s,單位微妙

//以下timeout設置了,就會input_open失敗,-10049
//av_dict_set(&optionsDict, "timeout", "3000000", 0);//設置超時3秒,單位http:ms,udp:s
av_dict_set(&optionsDict, "rw_timeout", "5000", 0);//單位:ms

int ret =0;
if ((ret=avformat_open_input(&pFormatCtx, url, NULL, &optionsDict)) != 0)
{
		log_error("Couldn't open input stream %d,ret);
		return -1;
}  

 

設置下面這個參數,就失敗

如果有大佬知道原因,可以留言,感謝

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章