Bug 761917 - Fail when stream restart is attempted on a dead PCM. r=doublec
authorMatthew Gregan <kinetik@flim.org>
Thu, 16 Aug 2012 18:48:40 +1200
changeset 102622 221388169ca7e1285c962cffaf9d5c5ba3f532d2
parent 102621 b83bfbfa9b608bc8ee66a3b9a85fadd8ae0ee28d
child 102623 c8f9da21bc8891413d2e853773b2102af6c2ede6
push id23297
push useremorley@mozilla.com
push dateFri, 17 Aug 2012 12:22:28 +0000
treeherdermozilla-central@e1cd9fb39dd7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec
bugs761917
milestone17.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 761917 - Fail when stream restart is attempted on a dead PCM. r=doublec
media/libcubeb/README_MOZILLA
media/libcubeb/src/cubeb_alsa.c
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb 
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
 
-The git commit ID used was 697b5c1279bf723d93b9d5f08e1fec6a6382bb77.
+The git commit ID used was 2d7d3e8f2ecabb70d2723f3c86fcb591a84b7f85.
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -1,17 +1,17 @@
 /*
  * Copyright © 2011 Mozilla Foundation
  *
  * This program is made available under an ISC-style license.  See the
  * accompanying file LICENSE for details.
  */
 #undef NDEBUG
 #define _BSD_SOURCE
-#define _POSIX_SOURCE
+#define _XOPEN_SOURCE 500
 #include <pthread.h>
 #include <sys/time.h>
 #include <assert.h>
 #include <limits.h>
 #include <poll.h>
 #include <unistd.h>
 #include <alsa/asoundlib.h>
 #include "cubeb/cubeb.h"
@@ -722,19 +722,24 @@ cubeb_stream_start(cubeb_stream * stm)
 {
   cubeb * ctx;
 
   assert(stm);
   ctx = stm->context;
 
   pthread_mutex_lock(&stm->mutex);
   snd_pcm_pause(stm->pcm, 0);
+  gettimeofday(&stm->last_activity, NULL);
   pthread_mutex_unlock(&stm->mutex);
 
   pthread_mutex_lock(&ctx->mutex);
+  if (stm->state != INACTIVE) {
+    pthread_mutex_unlock(&ctx->mutex);
+    return CUBEB_ERROR;
+  }
   cubeb_set_stream_state(stm, RUNNING);
   pthread_mutex_unlock(&ctx->mutex);
 
   return CUBEB_OK;
 }
 
 int
 cubeb_stream_stop(cubeb_stream * stm)