Bug 1032266 - Allow the alsa backend to be shutdown while draining. r=kinetik
authorPaul Adenot <paul@paul.cx>
Thu, 03 Jul 2014 18:50:40 +0200
changeset 215481 d18e878f91d52911ece4e257f849a611de922ce3
parent 215480 19f686d29ae6b05c599372c7c9c055afe7491bbe
child 215482 f78470faff8e3484af54d80a16ebc7bb63e0c4b3
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1032266
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1032266 - Allow the alsa backend to be shutdown while draining. r=kinetik
media/libcubeb/src/cubeb_alsa.c
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -866,22 +866,27 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
 }
 
 static void
 alsa_stream_destroy(cubeb_stream * stm)
 {
   int r;
   cubeb * ctx;
 
-  assert(stm && (stm->state == INACTIVE || stm->state == ERROR));
+  assert(stm && (stm->state == INACTIVE ||
+                 stm->state == ERROR ||
+                 stm->state == DRAINING));
 
   ctx = stm->context;
 
   pthread_mutex_lock(&stm->mutex);
   if (stm->pcm) {
+    if (stm->state == DRAINING) {
+      snd_pcm_drain(stm->pcm);
+    }
     alsa_locked_pcm_close(stm->pcm);
     stm->pcm = NULL;
   }
   free(stm->saved_fds);
   pthread_mutex_unlock(&stm->mutex);
   pthread_mutex_destroy(&stm->mutex);
 
   r = pthread_cond_destroy(&stm->cond);