I'm using pulseaudio version 0.9.15 in system mode.

I have one recording application which refuses to work properly with pulseaudio.
This same application has worked with previous versions of pulseaudio.

If I connect the app directly to alsa, or, use pasuspender, the application
works just how I expect it to.

I suspect there is something wrong with my main read loop in the application.
I must be doing something which pulseaudio doesn't like.

Can anyone please review my main read loop?  Do you see any isssues?

FWIW, I never see any "snd_pcm_readi failed messages in stderr.

int32 ad_read(ad_rec_t * handle, int16 * buf, int32 max)
{
   int32 length;

   snd_pcm_prepare(handle->dspH);

   for (;;) {
          length = snd_pcm_readi(handle->dspH, buf, max);
          // read success
          if (length >= 0) {
              break;
          }
          // no data available
          if (length == -EAGAIN) {
              length = 0;
              break;
          }
          fprintf(stderr, "snd_pcm_readi failed! %d %d %s\n", length, EAGAIN, 
snd_strerror(length));
          /* Failure, try to recover */
          if ((length = snd_pcm_recover( handle->dspH, length, 1)) < 0) {
              fprintf(stderr, "snd_pcm_recover failed! %s\n", 
snd_strerror(length));
              length = AD_ERR_GEN;
              break;
} /* Recovered, let's try another read */
   }

   return length;
}

What else can I look for?

Thanks,

Jim

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to