summaryrefslogtreecommitdiffstats
path: root/plugins/alsa
AgeCommit message (Collapse)AuthorFilesLines
2018-07-26Reduce verbosity of message "readThreadEntry..."Stephane Desneux1-6/+6
Moves the log level of the message from info to debug. Change-Id: I348421a17875b9061255c3b353e27070b0068c3b Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
2018-07-20rework the sound capture & playback modelThierry Bultel4-254/+324
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>
2018-07-20added ringbuffer and time utilsThierry Bultel7-1/+694
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-07-17alsa-core-pcm: sets sw start & stop thresholdsThierry Bultel1-12/+90
Uses the same logic as 'aplay' to set the start & stop thresholds. With this fix, there are no more periodic EPIPE errors when writing to playback Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-07-11stops the read/write loop when the stream is mutedThierry Bultel8-107/+286
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>
2018-07-03Uses the APIv3 compatibility to vdynThierry Bultel1-12/+0
Uses the new compatibility for vdyn based on V3 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-29Update version of app-controller-submodule submodule.Loïc Collignon1-1/+1
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>
2018-06-26Rework the pcm copy loop and save a lot of CPUeelThierry Bultel2-142/+188
- 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>
2018-06-22plugins: code & log cleanupThierry Bultel7-20/+21
2018-06-22pcm core: fixed spurious XRUN issuesThierry Bultel2-95/+257
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>
2018-06-22route plugin:fixed mismatch with several sound cardsThierry Bultel1-16/+40
Also sets the right number of channels. Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22set the correct number of channels in dmixThierry Bultel1-9/+40
The value set was wrong, and attempting to bump to an higher value later seems to be forbidden by the alsalib (led to EINVAL when getting parameters of PCM) Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22alsa-plug-vol: code & log cleanupThierry Bultel1-5/+11
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22alsa-utils-bypath: code & log cleanupThierry Bultel1-6/+15
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22alsa-utils-dump: added log upon failing parameters retrievalThierry Bultel1-5/+9
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22zones: fixed index mismatch when multiple sound cards are declaredThierry Bultel1-12/+19
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22alsa-api-mixer: code & log cleanupThierry Bultel1-14/+42
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22alsa-api-streams: code & log cleanupThierry Bultel1-27/+103
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22sinks: fixed index mismatch when multiple sound cards are declaredThierry Bultel1-6/+6
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-22pcm: return volume value with null set requestThierry Bultel1-4/+18
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-16Use correct chanel number when creating PCMhal-rc2-sandboxJonathan Aillet1-2/+2
Use correct chanel number when creating PCM. Change-Id: I17ac0273f9a6eec1d3b49845f579495f2cdcf9d7 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-13Replace verb prefix separatorJonathan Aillet1-2/+2
When adding a stream , instead of using a ':' to separate prefix and verb, use a '#'. Change-Id: I2cbb467a85c52dddd4714cfe644dcdf3a35df5d3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-11Correct issues when calling info verbJonathan Aillet1-7/+4
Correct issues when calling info verb : - Two 'AFB_ReqFail' was called when an error was detected on info call reqsuest json (generating an application framework error). - The error messages wasn't up to date. Change-Id: Ifbb94854bc8a9d13ddf702defa94eaa6cf87e9ba Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-11Fixed latest commitThierry Bultel1-2/+2
Wrong test on asprintf return code broke the app Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-11Fixed compilation warning with _FORTIFY_SOURCE=2Thierry Bultel6-37/+84
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-11Remove yocto compilation errorsJonathan Aillet2-2/+2
Remove yocto compilation errors concerning : - An unitialized variable in 'alsa-api-pcm.c' - A wrong use of asprintf in 'alsa-api-streams.c' Change-Id: I170993d060a7a1d1a1c20979da0645c5ef2b1b91 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-11Correct a conversion into ramp processingJonathan Aillet1-1/+1
The conversion from ms to us wasn't done correctly, it is fixed now. Change-Id: I004e2e42c9b6d9da4f7089d34406bef57ab21d9e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-11Autorize direct zone to point on sndcardfulup4-29/+56
2018-06-10Authorize new section at mixer initializationJonathan Aillet1-1/+2
Authorize the new section 'mixerapi' to be present into the json sent to initialize mixer. Change-Id: I7feed818f19f2d93566f6e1634933462828dbdf0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-10Correct a warning when using snd_output_printf functionJonathan Aillet1-1/+1
Instead of passing directly a 'const char *' to snd_output_printf function use a "%s" format. Change-Id: I46cd0fc6e5d139a6241dc3aa224b707d97a68125 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-10Documentation/cleanupfulup1-1/+2
2018-06-10Added cardid+verb return for capture+playback sndcardfulup3-73/+267
2018-06-10Added stream/ramp return to fit HAL attach requestfulup2-90/+155
2018-06-10Cleanup and added return of previous volume when setting new valuefulup14-147/+364
2018-06-07Added log for card lookup diagnosticThierry Bultel2-2/+7
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-07code cleanupThierry Bultel1-2/+2
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-07Code cleanup and fixed some typosThierry Bultel3-36/+48
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-06Move PCM write to synchronous write to remove XRUNfulup2-3/+3
2018-06-06Move smixer API create+attach into controller onload sectionfulup1-71/+9
2018-06-06Fixed the buffer copy size in read callbackThierry Bultel1-3/+5
Fixes the UNDERRUN issue (seen while playing radio, for instance) Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-06Fixed the MixerInfoAction replyThierry Bultel2-9/+5
Make it robust to empty source, and set the source when input is a direct capture device. Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-05Fix alsa URI within attach responsefulup1-2/+3
2018-06-05Use attach info verb to build attach response.fulup3-50/+26
2018-06-05Added per sink/source API for master controlfulup1-4/+8
2018-06-05Update info command and move HTML5 to new APIfulup6-69/+353
2018-06-04Fixed compilation issues with gcc >= 7.2Thierry Bultel4-5/+5
Fixed some warnings about uninitialized variables
2018-06-04Fixed json parsing format errorsThierry Bultel2-4/+5
The expected format did not match the parameters Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-04Move to Dynamic Mixer API (work in progress)Fulup Ar Foll21-1683/+2069
2018-05-18Update to last controller fixFulup Ar Foll1-2/+2
2018-05-18Added create/close mixer APIFulup Ar Foll3-62/+131