<div dir="ltr">Hi. I want to stream audio data from microphone and from some ogg audio file to my app.<div>There are pipelines:</div><div><br></div><div>from microphone: </div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">directsoundsrc</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">device=\"{1b70206d-3bb5-4246-a4b3-6aeddb8f1264}\"</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">audioconvert</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">audio/x-raw,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">format=(string)F32LE,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">rate=(int)48000,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">channels=(int)2,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">layout=(string)interleaved</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">appsink</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">name=flowsink</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">sync=true</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">from file:</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">filesrc</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">location=sound_file.ogg</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">oggdemux</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">vorbisdec</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">audioconvert</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">audio/x-raw,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">format=(string)F32LE,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">channels=(int)2,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">layout=(string)interleaved</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">audioresample</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">audio/x-raw,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">format=(string)F32LE,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">rate=(int)48000,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">channels=(int)2,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">layout=(string)interleaved</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!</span><span style="color:rgb(192,192,192)"> </span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">appsink</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">name=flowsink</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">sync=true</span></pre></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">That's how i read buffer from stream:</pre><pre style="margin-top:0px;margin-bottom:0px"> <br>     GstSample* gs = gst_app_sink_pull_sample(GST_APP_SINK( m_appsink));<br>        if (gs)<br>        {<br>            GstBuffer* gb = gst_sample_get_buffer(gs);  // no lifetime transfer<br>            GstMapInfo gm;<br>            if (!gb)<br>            {<br>               return false;<br>            }<br>            if (!gst_buffer_map(gb, &gm, GST_MAP_READ))<br>            {<br>               return false;<br>            }<br>            else<br>            {<br>                std::cout << "buffer size " << gm.size;<br>      }</pre><pre style="margin-top:0px;margin-bottom:0px">          }</pre><pre style="margin-top:0px;margin-bottom:0px">when i read buffer from microphone stream everything works as expected and i get </pre><pre style="margin-top:0px;margin-bottom:0px">100 buffers per second with size 3840 (3840 / 2 / 4 = 48000 kHz)</pre><pre style="margin-top:0px;margin-bottom:0px">but when i read from .ogg file i have strange buffer size which is usually 2048 and sometimes less</pre><pre style="margin-top:0px;margin-bottom:0px">and 200 buffers per second</pre><pre style="margin-top:0px;margin-bottom:0px">Why does it work like that?

</pre><div><br></div></div></div>