FFmpeg NaCl模块avformat_open_input(在rtsp流上)返回-5:I / O错误 [英] FFmpeg NaCl module avformat_open_input (on rtsp stream) returns -5: I/O error

查看:1065
本文介绍了FFmpeg NaCl模块avformat_open_input(在rtsp流上)返回-5:I / O错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Chrome PNaCl中创建一个RTSP播放器。



我已经成功构建了ffmpeg naclport,包括 build.sh 文件为ffmpeg NaCl端口。



- 启用网络--enable-protocols --enable-demuxer = rtsp --enable-demux = rtp --enable-demuxer = sdp --enable-decoder = h264



此外,我已经成功编码并链接了我自己的ffmpeg NaCl端口PNaCl模块。我已经在manifest.json文件中包含以下网络权限:

 权限:[
{
socket:[
tcp-listen:*:*,
tcp-connect:*:*,
resolve-host:*:* b $ budp-bind:*:*,
udp-send-to:*:*
],
}

现在,一旦我运行以下代码,在PNaCl中, avformat_open_input(...)返回-5或I / O错误

  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));

}

我可能做错了什么,为什么不能PNaCl模块访问RTSP流?



PS。 这是一个类似的问题,但它没有确定的答案。

您是否致电 avformat_open_input 从你的主线程?似乎socket操作被阻止在主线程中工作。



尝试将代码移动到后台线程,或者更好的是使用ppapi_simple,因为这会自动执行你的代码在后台线程。


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.

解决方案

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.

这篇关于FFmpeg NaCl模块avformat_open_input(在rtsp流上)返回-5:I / O错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆