Bug 1358868 - Uplift cubeb_wasapi stream_start crash fix. r=achronop, a=gchang
authorMatthew Gregan <kinetik@flim.org>
Fri, 12 May 2017 14:16:10 +1200
changeset 396265 8662226687a9f3d8d4196fbe0b107199179165db
parent 396264 c21ce937c63d547e9e18f726db98c773299e9662
child 396266 b891a2a9af3d824ae302a35300398be7b5554b73
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersachronop, gchang
bugs1358868
milestone54.0
Bug 1358868 - Uplift cubeb_wasapi stream_start crash fix. r=achronop, a=gchang
media/libcubeb/bug1358868.patch
media/libcubeb/src/cubeb_wasapi.cpp
media/libcubeb/update.sh
new file mode 100644
--- /dev/null
+++ b/media/libcubeb/bug1358868.patch
@@ -0,0 +1,21 @@
+commit 45c7ffca19f0bd43ee03e84a6d641a1b2a410793
+Author: Paul Adenot <paul@paul.cx>
+Date:   Thu May 4 14:22:09 2017 +0200
+
+    Return an error if stopping a WASAPI stream fails.
+
+diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
+index 1f106c9..e6cf687 100644
+--- a/src/cubeb_wasapi.cpp
++++ b/src/cubeb_wasapi.cpp
+@@ -1993,6 +1993,10 @@ int wasapi_stream_stop(cubeb_stream * stm)
+       delete stm->emergency_bailout.load();
+       stm->emergency_bailout = nullptr;
+     }
++  } else {
++    // If we could not join the thread, put the stream in error.
++    stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
++    return CUBEB_ERROR;
+   }
+ 
+   return CUBEB_OK;
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -1978,16 +1978,20 @@ int wasapi_stream_stop(cubeb_stream * st
   }
 
   if (stop_and_join_render_thread(stm)) {
     // This is null if we've given the pointer to the other thread
     if (stm->emergency_bailout.load()) {
       delete stm->emergency_bailout.load();
       stm->emergency_bailout = nullptr;
     }
+  } else {
+    // If we could not join the thread, put the stream in error.
+    stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
+    return CUBEB_ERROR;
   }
 
   return CUBEB_OK;
 }
 
 int wasapi_stream_get_position(cubeb_stream * stm, uint64_t * position)
 {
   XASSERT(stm && position);
--- a/media/libcubeb/update.sh
+++ b/media/libcubeb/update.sh
@@ -64,8 +64,11 @@ else
   echo "Remember to update README_MOZILLA with the version details."
 fi
 
 echo "Applying a patch on top of $version"
 patch -p1 < ./bug1345147.patch
 
 echo "Applying a patch on top of $version"
 patch -p3 < ./disable-assert.patch
+
+echo "Applying a patch on top of $version"
+patch -p1 < ./bug1358868.patch