[pulseaudio-discuss] Stream corruption using simple API after network lag

Eric Thornton gonesurfingnc at yahoo.com
Mon Jan 12 21:35:03 PST 2015


All,
I've been trying to pin down the cause of an audio issue with pulseaudio and an application called Quisk.  This is a software defined radio application that uses I&Q sampling (L&R channels) via a sound card. The SDR radio has both audio in and out going to a Wolfson pi audio card attached to a raspberry pi. My Ubuntu laptop runs the Quisk application and the Pi only runs pulseaudio.  Both are using version 5.0 of PA.
The issue is, after some time of small network buffer underruns or a short time of large network underruns, the incoming IQ audio stream suddenly becomes white noise. Occasionally, the IQ samples appear to be offset by a sample or more, as the SDR application suddenly looses its ability to reject mirror images. When either of these phenomenon occur I usually have to restart the application to recover, however occasionally a subsequent network underrun will "fix" the issue. When either the mirroring problem or the white noise problem occurs, I can start a second instance of the application which will act normally. This makes me think it's not a soundcard issue, but something to do with pulseaudio and either it's alsa device buffer or the network buffer. One other observation is that this problem only seems to happen when i have both read and play streams going at the same time... just one read stream seems to be robust.
This application uses the simple API. I have tried every combination of buffering attribute I can think of, and have not been able to prevent this issue (except by using Ethernet vs WiFi). I can deal with occasional stream stuttering, but this noise/stream corruption is a show stopper. Has this been encountered before?
Info below. Thanks in advance.
Eric

Here are the basic parameters passed when opening both local and remote sound streams.
   ss.format = PA_SAMPLE_S16LE;   ss.rate = dev->sample_rate;   ss.channels = dev->num_channels;
   if ( strcmp(stream_description, "IQ Input") == 0) {      server = "192.168.0.6"; //remote sound server      ba.maxlength = (uint32_t) 48000;       ba.fragsize = (uint32_t) -1;      s = pa_simple_new(server, "Quisk", direction, dev_name, stream_description, &ss, NULL, &ba, &error);   }   else if ( strcmp(stream_description, "IQ Output") == 0) {      server = "192.168.0.6"; //remote sound server
      ba.maxlength = (uint32_t) 96000;      ba.prebuf = (uint32_t) -1;      ba.tlength = (uint32_t) -1;      ba.minreq = (uint32_t)-1;      s = pa_simple_new(server, "Quisk", direction, dev_name, stream_description, &ss, NULL, &ba, &error);   }   else        server = NULL; //use local sound server
      s = pa_simple_new(server, "Quisk", direction, dev_name, stream_description, &ss, NULL, NULL, &error);   Here is a trimmed down version of my daemon.conf file on the remote rpi. All other values are either default or not relevant to this issue.
high-priority = yesnice-level = -11
realtime-scheduling = yesrealtime-priority = 5
resample-method = trivial
; default-sample-format = s16ledefault-sample-rate = 96000alternate-sample-rate = 48000
default-fragments = 4default-fragment-size-msec = 40








-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20150113/07614e55/attachment-0001.html>


More information about the pulseaudio-discuss mailing list