D. R. Evans wrote on 6/3/20 9:06 PM: > I have spent most of the past couple of days trying to understand why a > program is failing to obtain data from a device. > > I have stripped away the code down to this very simple (and silly) sample: > > -------- > > cout << "avail +5s = " << snd_pcm_avail(_handle) << endl; > cout << "calling snd_pcm_readi" << endl; > > char sdata [10000]; > const snd_pcm_sframes_t r = snd_pcm_readi(_handle, &sdata, 10); > > cout << "value returned by _readi_func = " << r << endl; > > -------- > > The output produced is: > > avail +5s = 3999 > calling snd_pcm_readi > > The call to snd_pcm_readi() never returns, and I have no idea why, as avail() > says that there are plenty of data waiting to be read. > > For what it's worth, snd_pcm_dump() says: > > -------- > > ACCESS: RW_INTERLEAVED > FORMAT: S16_LE > SUBFORMAT: STD > SAMPLE_BITS: 16 > FRAME_BITS: 32 > CHANNELS: 2 > RATE: 8000 > PERIOD_TIME: 125000 > PERIOD_SIZE: 1000 > PERIOD_BYTES: 4000 > PERIODS: 4 > BUFFER_TIME: 500000 > BUFFER_SIZE: 4000 > BUFFER_BYTES: 16000 > TICK_TIME: 0 > > -------- > > This behaviour is 100% consistent, and I am at a loss as to what I might be > doing wrong. > > Any insights very gratefully received. Obviously, more information is > available if needed. > Increasing my puzzlement, I tried opening the device in non-blocking mode... and the above behaviour remains true; i.e., snd_pcm_readi() never returns. As far as I can tell, that's not supposed to be possible. So something is very wrong somewhere, even though I believe that I check all the return values from all the ASLA functions called up to this point, and everything looks good up until the call to snd_pcm_readi(). Any suggestions as to where to look or what to examine to find a clue as to what's wrong? Doc -- Web: http://enginehousebooks.com/drevans
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Alsa-user mailing list Alsa-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-user