<div dir="ltr">Hi, I am trying to create an app on android that can play MPEG stream. So I have following code:<div>







<p class=""><span class="">AVFormatContext</span>*    <span class="">LibavDecoder::openInput</span>               ()</p>
<p class="">{</p>
<p class="">    AVFormatContext *avFormatContextPtr = NULL;</p>
<p class="">    <span class="">int</span>             err                 = 0;</p>
<p class=""><br></p>
<p class="">    <span class="">this</span>-><span class="">iobuffer</span>                      = (<span class="">unsigned</span> <span class="">char</span>*) av_malloc(bufferSize);</p>
<p class="">    avFormatContextPtr                  = avformat_alloc_context();</p>
<p class="">    avFormatContextPtr-><span class="">pb</span>              = avio_alloc_context(<span class="">this</span>-><span class="">iobuffer</span>, bufferSize, 0, receiver, IORead, NULL, NULL);</p>
<p class="">    avFormatContextPtr-><span class="">pb</span>-><span class="">seekable</span>    = 0;</p>
<p class="">    err = avformat_open_input(&avFormatContextPtr, <span class="">""</span>, NULL, NULL);<br></p>
<p class="">    <span class="">if</span> (err != 0)<br></p>
<p class="">    {</p>
<p class=""><span class="">        error(</span>"Error while calling avformat_open_input"<span class="">, err);</span></p>
<p class="">    } <span class="">else</span></p>
<p class="">    {</p>
<p class="">        err = avformat_find_stream_info(avFormatContextPtr, 0);</p>
<p class="">        <span class="">if</span> (err < 0)</p>
<p class=""><span class="">            error(</span>"Error while calling avformat_find_stream_info"<span class="">, err);</span></p>
<p class="">    }</p>
<p class="">    <span class="">return</span> avFormatContextPtr;</p>
<p class="">}</p><p class=""><br></p><p class="" style>But for some reason, the call "avformat_open_input" doesn't return. So I put logging into the libavformat and found out that, in the "utils.c", function "av_probe_input_buffer" called by "init_input", which is called by "avformat_open_input", doesn't return. </p>
<p class="" style>The same code works fine on iOS, but not on Android 2.3.3 and above. Any help will be greatly appreciated.</p></div></div>