<div dir="ltr"><div>Hi Ross - <br><br></div><div>Thanks for getting back to me. I've copied in my doGetNextFrame because I'm not seeing anything that is particularly wrong here from your last email... would you possibly be willing to shed any light on my mistakes? I would so appreciate it!!!<br><br></div><div>Kind Regards,<br></div><div><br></div><div> - James<br><br>void AudioBufferSource::doGetNextFrame() {<br>  fFrameSize = 0; // until it's set later<br><br>  if (fPreferredFrameSize < fMaxSize) {<br>      fMaxSize = fPreferredFrameSize;<br>  }<br>  unsigned bytesPerSample = (fNumChannels*fBitsPerSample) / 8;<br>  if (bytesPerSample == 0) bytesPerSample = 1; // because we can't read less than a byte at a time<br><br>  unsigned samplesToRead = fMaxSize / bytesPerSample;<br>  unsigned numSamplesRead;<br><br>  numSamplesRead = fBufferManager->getFrames((int16_t*)fTo, samplesToRead);<br><br>  unsigned numBytesRead = numSamplesRead * bytesPerSample;<br>  fFrameSize += numBytesRead;<br>  fTo += numBytesRead; //TODO - eval - is this line necessary<br>  fMaxSize -= numBytesRead;<br>  fNumBytesToStream -= numBytesRead;<br><br>  // Set the 'presentation time' and 'duration' of this frame:<br>  if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0) {<br>      // This is the first frame, so use the current time:<br>      gettimeofday(&fPresentationTime, NULL);<br>  }<br>  else {<br>      // Increment by the play time of the previous data:<br>      unsigned uSeconds = fPresentationTime.tv_usec + fLastPlayTime;<br>      fPresentationTime.tv_sec += uSeconds / 1000000;<br>      fPresentationTime.tv_usec = uSeconds % 1000000;<br>  }<br><br>  // Remember the play time of this data:<br>  fDurationInMicroseconds = fLastPlayTime = (unsigned)((fPlayTimePerSample*fFrameSize) / bytesPerSample);<br><br>  // Inform the reader that he has data:<br>  // To avoid possible infinite recursion, we need to return to the event loop to do this:<br>  nextTask() = envir().taskScheduler().scheduleDelayedTask(0, (TaskFunc*)FramedSource::afterGetting, this);<br>}<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 19, 2014 at 10:52 PM, Ross Finlayson <span dir="ltr"><<a href="mailto:finlayson@live555.com" target="_blank">finlayson@live555.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div dir="ltr"><div>Audio is getting on to the network but in a bad state with many pops ticks and glitches, and a lot of variable latency.</div></div></blockquote><div><br></div></span>This suggests that you're probably not packing PCM audio samples into outgoing RTP packets properly.  Make sure that your source's "doGetNextFrame()" implementation is packing an appropriate number of complete PCM audio samples (remember that you'll have 2x as many bytes if the audio is stereo) before calling "FramedSource::afterGetting()".  Also make sure that you're setting "fPresentationTime" properly (it must be aligned with 'wall clock' time: the time that you'd get by calling "gettimeofday()".)  You also need to set "fDurationInMicroseconds" appropriately each time.</div><span class="HOEnZb"><font color="#888888"><br><div>
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/" target="_blank">http://www.live555.com/</a></span></span>
</div>
<br></font></span></div><br>_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
<br></blockquote></div><br></div></div>