Bug 1032266 - Allow the alsa backend to be shutdown while draining. r=kinetik, a=lmandel
authorPaul Adenot <paul@paul.cx>
Thu, 03 Jul 2014 18:50:40 +0200
changeset 209102 e7360cef9de1eb14033b10b5172254170cdcdc05
parent 209101 f599b01ed454db6470154d05ee4e091d0fd6aa87
child 209103 883f4666206ee53f5834be6d1361e264f62bd487
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, lmandel
bugs1032266
milestone32.0a2
Bug 1032266 - Allow the alsa backend to be shutdown while draining. r=kinetik, a=lmandel
media/libcubeb/src/cubeb_alsa.c
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -862,22 +862,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);