FFmpeg NaCl module avformat_open_input (on rtsp stream) returns -5: I/O error

試著忘記壹切 提交于 2019-12-12 19:23:36

问题


I want to create an RTSP player in Chrome PNaCl.

I have successfully built the ffmpeg naclport including the following networking flags in the build.sh file for the ffmpeg NaCl port.

--enable network --enable-protocols --enable-demuxer=rtsp --enable-demux=rtp --enable-demuxer=sdp --enable-decoder=h264

Furthermore, I have successfully coded and the linked the ffmpeg NaCl port in my own PNaCl module. I have included the following network permissions in the manifest.json file:

"permissions": [
{
    "socket": [
        "tcp-listen:*:*", 
        "tcp-connect:*:*", 
        "resolve-host:*:*", 
        "udp-bind:*:*", 
        "udp-send-to:*:*"
    ],
}

Now once I run the following code, in PNaCl, the avformat_open_input(...) returns -5 or I/O Error:

    AVFormatContext* formatContext = avformat_alloc_context();

    av_register_all();

    avformat_network_init();

    const char * stream_path = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";

    int result = avformat_open_input(&formatContext, stream_path ,NULL,NULL);

    if(result< 0){

        PostMessage("input not opened, result: ");

        PostMessage(result);

    }else{

      PostMessage(std::string("input successfully opened"));

    }

What am I possibly doing wrong, and why can't the PNaCl module access the RTSP stream?

PS. This is a similar question, but it gives no definitive answer.


回答1:


Are you calling avformat_open_input from your main thread? It seems like socket operations are blocked from working in the main thread.

Try moving your code to a background thread or, better yet, use ppapi_simple as this automatically executes your code in a background thread.



来源:https://stackoverflow.com/questions/34610191/ffmpeg-nacl-module-avformat-open-input-on-rtsp-stream-returns-5-i-o-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!