Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
when the stream is muted (due to the configuration, or
due to a HAL request), the read/write loop is stopped.
The benefit is that muting will work with capture devices
that do not implement the mute in their driver.
The inconvenient of stopping the read loop is that it
has made appear an unexpected side-effect: the poll on
capture does not trig for further incoming frames.
The workaround is to completely close, then reopen
and configure the capture PCM.
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
|
|
Changes of app-controller-submodule:
(0f3063b - Romain Forlot) Be able to dispatch required api at the wanted time
(1ff524b - Romain Forlot) Change LUA package path at LUA interpreter load
(738ae54 - Romain Forlot) Don't load two times a plugin even for LUA
(c04f029 - Sebastien Douheret) Fixed hidden bound variable (apiHandle)
(cfe3919 - Sebastien Douheret) Fixed null value when push Lua arguments
(69c0585 - José Bollo) Adjust to compile with incoming bindings v3
(d7e260c - José Bollo) Remove declaration to not existing functions
(8ac6625 - Romain Forlot) Add 2 lua utilities function
(d3504bb - Jonathan Aillet) Update README.md for new metadata keys.
Change-Id: I794ed0ca3a054e7baf11769207007ef733854474
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
|
|
- removed the systemd polling usage
- uses a while loop for reading
- improved the write loop, leveraging the available space
at each iteration
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
|
|
This fixes the numerous XRUN issues seen on some cards.
The trick is to set the buffer_size & period size in
hw parameters. These ones are calculated from an expected
maximum latency.
Also, the writei is done in a loop to be robust to overruns
and partial writes.
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mixing with volume and mute per audio role works.
|
|
|
|
|
|
|
|
|