aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2018-06-06 23:41:00 +0200
committerfulup <fulup.arfoll@iot.bzh>2018-06-06 23:41:00 +0200
commitf21bd1bdcc64e688a156231aa8cf67c49ce1871c (patch)
tree62c785b652ca56155a7c102a34ab64447603bc1d
parent0575201d3842e9eb32cd75873484f2ecd25952d7 (diff)
Move PCM write to synchronous write to remove XRUN
-rw-r--r--nbproject/configurations.xml247
-rw-r--r--plugins/alsa/alsa-api-streams.c4
-rw-r--r--plugins/alsa/alsa-core-pcm.c2
3 files changed, 234 insertions, 19 deletions
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
index 6ba83ec..c6d3673 100644
--- a/nbproject/configurations.xml
+++ b/nbproject/configurations.xml
@@ -294,26 +294,14 @@
<folder path="0/mixer-binding">
<cTool>
<incDir>
- <pElem>/usr/include/json-c</pElem>
- <pElem>../../../opt/include</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
- <pElem>/usr/include/uuid</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/lua5.3</pElem>
+ <pElem>../../../opt/include/afb</pElem>
<pElem>mixer-binding</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
<pElem>app-afb-helpers-submodule</pElem>
<pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>../../../opt/include</pElem>
<pElem>build/mixer-binding</pElem>
</incDir>
- <preprocessorList>
- <Elem>AFB_BINDING_VERSION=dyn</Elem>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc:/home/fulup/opt/4a-smixer/etc"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d:/home/fulup/opt/4a-smixer/var"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/lib/plugins:/home/fulup/opt/4a-smixer/lib/plugins"</Elem>
- <Elem>CTL_PLUGIN_MAGIC=987456123</Elem>
- <Elem>USE_API_DYN=1</Elem>
- <Elem>softmixer_binding_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/plugins">
@@ -343,12 +331,24 @@
</cTool>
</folder>
<item path="mixer-binding/mixer-binding.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="1">
</cTool>
</item>
<item path="plugins/alsa/alsa-api-loop.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -359,6 +359,18 @@
<item path="plugins/alsa/alsa-api-mixer.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -369,6 +381,18 @@
<item path="plugins/alsa/alsa-api-pcm.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -379,6 +403,18 @@
<item path="plugins/alsa/alsa-api-ramp.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -389,6 +425,18 @@
<item path="plugins/alsa/alsa-api-sink.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -399,6 +447,18 @@
<item path="plugins/alsa/alsa-api-source.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -409,7 +469,16 @@
<item path="plugins/alsa/alsa-api-streams.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
</incDir>
<preprocessorList>
<Elem>alsa_softmixer_EXPORTS</Elem>
@@ -419,6 +488,18 @@
<item path="plugins/alsa/alsa-api-zones.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -428,6 +509,20 @@
</item>
<item path="plugins/alsa/alsa-capture.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
+ <incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
+ </incDir>
<preprocessorList>
<Elem>CONTROL_CONFIG_PATH="/home/fulup/opt/4a-softmixer/etc:/home/fulup/Workspace/Audio-4a/4a-softmixer/build/package/etc"</Elem>
<Elem>CONTROL_LUA_PATH="/home/fulup/opt/4a-softmixer/data:/home/fulup/Workspace/Audio-4a/4a-softmixer/conf.d/project/lua.d"</Elem>
@@ -440,6 +535,18 @@
<item path="plugins/alsa/alsa-core-ctl.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -450,6 +557,18 @@
<item path="plugins/alsa/alsa-core-pcm.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -460,6 +579,18 @@
<item path="plugins/alsa/alsa-effect-ramp.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -470,6 +601,18 @@
<item path="plugins/alsa/alsa-plug-dmix.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -480,6 +623,18 @@
<item path="plugins/alsa/alsa-plug-rate.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -490,6 +645,18 @@
<item path="plugins/alsa/alsa-plug-route.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -500,6 +667,18 @@
<item path="plugins/alsa/alsa-plug-vol.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -510,6 +689,18 @@
<item path="plugins/alsa/alsa-softmixer.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -520,6 +711,18 @@
<item path="plugins/alsa/alsa-utils-bypath.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
@@ -530,6 +733,18 @@
<item path="plugins/alsa/alsa-utils-dump.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>app-controller-submodule/ctl-lib</pElem>
+ <pElem>build/app-controller-submodule/ctl-lib</pElem>
+ <pElem>/usr/include</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/alsa</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>/usr/include/uuid</pElem>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>mixer-binding</pElem>
+ <pElem>app-afb-helpers-submodule</pElem>
+ <pElem>build/plugins/alsa</pElem>
<pElem>/usr/include/lua5.3</pElem>
</incDir>
<preprocessorList>
diff --git a/plugins/alsa/alsa-api-streams.c b/plugins/alsa/alsa-api-streams.c
index 487b0fe..876162d 100644
--- a/plugins/alsa/alsa-api-streams.c
+++ b/plugins/alsa/alsa-api-streams.c
@@ -245,8 +245,8 @@ PUBLIC int CreateOneStream(SoftMixerT *mixer, AlsaStreamAudioT *stream) {
captureName = (char*) streamPcm->cid.cardid;
}
- // everything is not ready to open playback pcm
- error = snd_pcm_open(&streamPcm->handle, captureName, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ // everything is now ready to open playback pcm in BLOCKING_MODE this time
+ error = snd_pcm_open(&streamPcm->handle, captureName, SND_PCM_STREAM_PLAYBACK, 0);
if (error) {
AFB_ApiError(mixer->api, "CreateOneStream: mixer=%s stream=%s fail to open capturePcm=%s error=%s", mixer->uid, stream->uid, streamPcm->cid.cardid, snd_strerror(error));
goto OnErrorExit;
diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c
index 32c7678..3362377 100644
--- a/plugins/alsa/alsa-core-pcm.c
+++ b/plugins/alsa/alsa-core-pcm.c
@@ -227,7 +227,7 @@ STATIC int AlsaPcmReadCB(sd_event_source* src, int fd, uint32_t revents, void* u
framesOut = snd_pcm_writei(pcmCopyHandle->pcmOut, pcmCopyHandle->buffer, framesIn);
//framesOut = snd_pcm_mmap_writei (pcmCopyHandle->pcmOut, pcmCopyHandle->buffer, framesIn);
if (framesOut < 0 || framesOut != framesIn) {
- AFB_ApiNotice(pcmCopyHandle->api, "AlsaPcmReadCB PcmOut=%s UNDERUN frame=%ld / %ld", ALSA_PCM_UID(pcmCopyHandle->pcmOut, string), framesOut ,framesIn);
+ AFB_ApiNotice(pcmCopyHandle->api, "AlsaPcmReadCB PcmOut=%s UNDERUN frame=%ld=>%ld error=%s", ALSA_PCM_UID(pcmCopyHandle->pcmOut, string), framesOut ,framesIn, snd_strerror((int)framesOut));
snd_pcm_prepare(pcmCopyHandle->pcmOut);
goto ExitOnSuccess;
}