summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-06-25 21:39:21 +0200
committerGitHub <noreply@github.com>2018-06-25 21:39:21 +0200
commita219152bddead6b34f40ae86217f39fbda91aab6 (patch)
tree9c39e445f65e6ce4075f80e512f4bacfea31577c /media
parent593835e861ce3ab3f9d58aa1fc241399f1c1f244 (diff)
parent121434f6f73e7d99ed25f817f84efcd27d63d505 (diff)
downloadUXP-a219152bddead6b34f40ae86217f39fbda91aab6.tar
UXP-a219152bddead6b34f40ae86217f39fbda91aab6.tar.gz
UXP-a219152bddead6b34f40ae86217f39fbda91aab6.tar.lz
UXP-a219152bddead6b34f40ae86217f39fbda91aab6.tar.xz
UXP-a219152bddead6b34f40ae86217f39fbda91aab6.zip
Merge pull request #547 from adeshkp/patch-7
Rewrite assert in alsa_refill_stream to pass back a cubeb error instead.
Diffstat (limited to 'media')
-rw-r--r--media/libcubeb/src/cubeb_alsa.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libcubeb/src/cubeb_alsa.c b/media/libcubeb/src/cubeb_alsa.c
index 1ea0961d0..72a6acfb1 100644
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -317,7 +317,12 @@ alsa_refill_stream(cubeb_stream * stm)
snd_pcm_recover(stm->pcm, wrote, 1);
wrote = snd_pcm_writei(stm->pcm, p, got);
}
- assert(wrote >= 0 && wrote == got);
+ if (wrote < 0 || wrote != got) {
+ /* Recovery failed, somehow. */
+ pthread_mutex_unlock(&stm->mutex);
+ stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
+ return ERROR;
+ }
stm->write_position += wrote;
gettimeofday(&stm->last_activity, NULL);
}