aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-07-20 13:02:37 +0200
committerThierry Bultel <thierry.bultel@iot.bzh>2018-07-20 13:02:37 +0200
commit1db355212e7d2d39e7cb150b83937200150477c9 (patch)
tree8b9fc75ccef47056c29a09d569a185f802907a97 /README.md
parent712b3a2cda69422931b26283054e476e3d554a06 (diff)
rework the sound capture & playback model
Now uses two threads for in the playing loop The first one reads from the capture device (ie, a phys. capture, or snd_aloop) and writes data to a circular buffer. The second one gets data from the circular buffer and outputs it to the playback. This model solves a lot of correlated timing bugs between read & write tasks. The read tasks only wakes up the write task when the buffer is 80% full. The buffer size big enough to hold 2 seconds of sound. The mute implementation has also been simplified, since it has been found out that it was possible to recover from an interrupted read, by calling snd_pcm_start additionnally to snd_pcm_prepare. Thus, the mute code consists in listening to an extra file descriptor in the read loop. Reading from that descriptor gives the mute or unmute command sent at higher level (in the PCM control event callback). When a 'mute' order is get, the capture sound fd is simply backup and replaced by '-1' in the set of the poll of the read task. When a 'unmute' order is get, the fd is simply restored. The start threshold is only computed for capture, and hardcoded to 1 for playback. This removes most of the remaining EPIPE on playback. The stop threshold has been removed. It had bad side effects on the amount of writeable data returned by snd_pcm_avail_update (was returning too small chunks) Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions