Home > OS >  With ALSA a thread that executes the capture and playback underrun appeared
With ALSA a thread that executes the capture and playback underrun appeared

Time:10-29

First problem phenomena such as topic, the specific situation is my first catpure then playback in one thread, the results found in the related playback function calls, snd_pcm_writei can continuous underrun occurred phenomenon (the return value is - 32), normal voices can be heard, and is accompanied by a "zi zi",
First of all in my program for cature and playback equipment configuration parameters are reference to arecord (aplay) source for writing, so parameters should not have what problem,
Then I test the "arecord parameter | aplay parameters" this test method, found that it is no almost no underrun phenomenon of (a) or occasionally, but this way is inter-process communication, symbols used in the pipe "|", my program no inter-process communication, only open threads,
Excuse me, does anyone know how to design the capture in a program, playback communication, if you can, give some reference code

CodePudding user response:

Problem solving and call snd_pcm_hw_params_set_period_size_near and snd_pcm_hw_params_set_buffer_size_near, pass the appropriate parameters

CodePudding user response:

More to try and solve likely

CodePudding user response:

refer to the second floor LubinLew response:
try and more likely to solve the

Tried, found that a thread is the capture and playback can also solve the problem of underrun, the exhaustive method, still have to keep to try with alsa parameters, there is a possibility of solution
  • Related