<div dir="ltr">Greetings,<div><br></div><div style>Thank you Ross for your response mid-week.</div><div style>I believe I've correctly implemented your suggestion, but I'm still experiencing the same issue.</div><div style>
<br></div><div style>Recap: I'm trying to send mu-law audio over <span class="" style="background-color:yellow"><span class="" style>RTP</span></span>. The audio comes from the microphone on an <span class="" style="background-color:yellow"><span class="" style>ios</span></span> device, via <span class="" style="background-color:yellow"><span class="" style>AudioQueue</span></span>. </div>
<div style><br></div><div style>I'm following <span class="" style>testWaveAudioStreamer</span>.</div><div style>I've <span class="" style>subclassed</span> <span class="" style>FramedSource</span> and pass the audio through <span class="" style>uLawFromPCMAudioSource</span> after it's stored in a circular FIFO buffer (after being returned from the <span class="" style>ios</span> <span class="" style>AudioQueue</span> callback after mic capture).</div>








<div style><br></div><div style>Issue: I get "skipping" ~ 0.5 sec audio, then ~ 0.5 sec silence.<br>The buffer is still under running (causing a sleep in <span class="" style="background-color:yellow"><span class="" style>deliverFrame</span></span>() which I believe should never be happening once I have this correctly implemented).</div>
<div style><br></div><div style>As per Ross' excellent suggestion I've set <span class="" style="background-color:yellow"><span class="" style>fDurationInMicroseconds</span></span> like this:</div><div style>







<p class="">    <span class="">int</span> <span class="" style="background-color:yellow"><span class="" style>fNumChannels</span></span> =<span class="">1</span>;</p>
<p class="">    <span class="">int</span> <span class="" style="background-color:yellow"><span class="" style>fBitsPerSample</span></span> = <span class="">16</span>;</p>
<p class="">    <span class="">int</span> <span class="" style="background-color:yellow"><span class="" style>fSamplingFrequency</span></span> = <span class="">8000</span>;</p>
<p class="">     <span class="">unsigned</span> <span class="" style="background-color:yellow"><span class="" style>fPlayTimePerSample</span></span> = <span class="">1e6</span>/(<span class="">double</span>)<span class="" style="background-color:yellow"><span class="" style>fSamplingFrequency</span></span>;</p>

<p class="">      <span class="">unsigned</span> <span class="" style="background-color:yellow"><span class="" style>bytesPerSample</span></span> = (<span class="" style="background-color:yellow"><span class="" style>fNumChannels</span></span>*<span class="" style="background-color:yellow"><span class="" style>fBitsPerSample</span></span>)/<span class="">8</span>;</p>

<p class="">    <span class=""><span class="" style="background-color:yellow"><span class="" style>fDurationInMicroseconds</span></span></span> =(<span class="">unsigned</span>)((<span class="" style="background-color:yellow"><span class="" style>fPlayTimePerSample</span></span>*<span class=""><span class="" style="background-color:yellow"><span class="" style>fFrameSize</span></span></span>)/<span class="" style="background-color:yellow"><span class="" style>bytesPerSample</span></span>);</p>
<p class="">-----</p><p class="" style>The <span class="" style="background-color:yellow"><span class="" style>fDurationInMicroseconds</span></span> works out to 500000 microseconds, which would make sense as each buffer returned from the <span class="" style="background-color:yellow"><span class="" style>ios</span></span> <span class="" style="background-color:yellow"><span class="" style>AudioQueue</span></span> is about 0.5 seconds. </p>
<p class="" style>I'll paste some output from <span class="" style="background-color:yellow"><span class="" style>VLC</span></span>. If anyone can point me in the right direction to correct my error here I'd appreciate it immensely.</p>
<p class="" style>FYI, I'll be posting this code publicly once it's working for all to use.</p><p class="" style></p><p class="">Thanks so much for your time, and the hard work on an excellent library.</p><p></p><p class="" style>
Best regards,</p><p class="" style>Braden <span class="" style>Ackerman</span></p><p class="" style><span class="" style>VLC</span> complains like this: </p><p class="" style></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (179500), up-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (358875), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (230875), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (356000), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (228000), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (356000), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (228000), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (356000), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (347500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (219500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (347500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (219500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (347500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (219500), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>audio output is starving (-720558), playing silence</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (322098), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (194098), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (322098), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (194098), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too early (-177606), clearing queue</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too early (-51609), down-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (128016), up-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too early (-231484), clearing queue</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (245727), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (117727), up-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (297227), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too early (-126440), clearing queue</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too late (195604), dropping buffer</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (67604), up-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>audio output out of sync, adjusting dates (-44447 us)</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>computed <span class="" style>PTS</span> is out of range (36360), clearing out</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>not synchronized (-44445 us), <span class="" style>resampling</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too early (-44445), down-sampling</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>audio output is starving (-971888), playing silence</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)"><span class="" style>rtp</span></span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>1 packet(s) lost</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>End of audio <span class="" style>preroll</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)"><span class="" style>rtp</span></span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>1 packet(s) lost</p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>End of audio <span class="" style>preroll</span></p><p style="font-family:arial,sans-serif;font-size:13px;margin:0px">
<span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span><span class="" style>resampling</span> stopped after 1060698 <span class="" style>usec</span> (drift: 0)</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (179500), up-sampling</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)"><span class="" style>rtp</span></span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>1 packet(s) lost</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)"><span class="" style>rtp</span></span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>1 packet(s) lost</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>End of audio <span class="" style>preroll</span></p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span><span class="" style>resampling</span> stopped after 894671 <span class="" style>usec</span> (drift: -179375)</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)"><span class="" style>rtp</span></span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>1 packet(s) lost</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(128,128,128)"> debug: </span>End of audio <span class="" style>preroll</span></p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer too late (179500), up-sampling</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>buffer way too early (-370330), clearing queue</p>
<p style="font-family:arial,sans-serif;font-size:13px;margin:0px"><span style="font-style:italic;color:rgb(0,0,139)">main</span><span style="font-style:italic;color:rgb(0,128,0)"> warning: </span>timing screwed, stopping <span class="" style>resampling</span></p>
<p></p><p class="" style><br></p></div></div>