[Live-devel] Stream to sound card hickups

Gertjan de Back gertjan.de.back.2006 at cer.com
Mon Oct 9 04:21:37 PDT 2006


Hello all,

I'm using the LiveMedia stack to play an RTP based VoIP audio stream (uLaw) to a sound 
card (VIA82C686/AC97). Basically I open a FileSink (/dev/dsp) and SimpleRTPSource as 
follows:

~~~~
  in_addr clientip;
  clientip.s_addr = our_inet_addr("192.168.10.216");

  fileSink = FileSink::createNew(*env, "/dev/dsp", 20000, False);
  if (fileSink == NULL) {
    *env << "\nFailed to open audio device.\n";
    return 0;
  }

  Groupsock rtpGroupsock(*env, clientip, 10010, 1);

  SimpleRTPSource* RTPSource
    = SimpleRTPSource::createNew(*env, &rtpGroupsock, (unsigned char)0,
      8000, "PCMU", (unsigned)0, False);
  if (RTPSource == NULL) {
    *env << "error while creating RTPSource\n";
    return 0;
  }

  receivedAudioSource = PCMFromuLawAudioSource::createNew(*env, RTPSource);
  if(receivedAudioSource == NULL) {
    *env << "Error while creating u-law to 16bit PCM converter\n";
    return 0;
  }

  fileSink->startPlaying(*receivedAudioSource, subsessionAfterPlaying, NULL);

  env->taskScheduler().doEventLoop(); // does not return
~~~~

It works okay, except for irregular delays in playback of the incoming RTP stream. 
Occasional buffer underruns are seen in the via82cxx_audio driver in Linux 2.4.32 which 
seem to temporarily pause the DMA transfers causing hicks and delays up to a few seconds, 
which makes it unusable for a telephone conversation.

* Did I understand the use of the API correctly?
* Is there any proved sample code to play a stream to the sound card?
* Has anyone experienced similar hicks/delays in playback to a (VIA) sound card?
* Does anyone know of a LiveMedia based app which runs fine on the VIA audio chip?

Thanks for your help!

Gertjan de Back



More information about the live-devel mailing list