From f21bd1bdcc64e688a156231aa8cf67c49ce1871c Mon Sep 17 00:00:00 2001 From: fulup Date: Wed, 6 Jun 2018 23:41:00 +0200 Subject: Move PCM write to synchronous write to remove XRUN --- plugins/alsa/alsa-api-streams.c | 4 ++-- plugins/alsa/alsa-core-pcm.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/alsa') 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; } -- cgit 1.2.3-korg