diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 14:14:26 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 14:14:26 -0500 |
commit | 1960d6e08a949ceed50e6a18240d40a7ecee879c (patch) | |
tree | 580b06d4df15ff5f8a9c3f20468bf2160ac666e5 /media/libcubeb/fix-crashes.patch | |
parent | 732fe36241032a1793e09209ccc06cb720225b9e (diff) | |
download | UXP-1960d6e08a949ceed50e6a18240d40a7ecee879c.tar UXP-1960d6e08a949ceed50e6a18240d40a7ecee879c.tar.gz UXP-1960d6e08a949ceed50e6a18240d40a7ecee879c.tar.lz UXP-1960d6e08a949ceed50e6a18240d40a7ecee879c.tar.xz UXP-1960d6e08a949ceed50e6a18240d40a7ecee879c.zip |
Revert "Issue #1267 - Part 1: Update libcubeb to a1200c34."
This reverts commit d162ecbaffe845c9707da5d2f6cab11f343ef00e.
Diffstat (limited to 'media/libcubeb/fix-crashes.patch')
-rw-r--r-- | media/libcubeb/fix-crashes.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/media/libcubeb/fix-crashes.patch b/media/libcubeb/fix-crashes.patch new file mode 100644 index 000000000..b23501fcf --- /dev/null +++ b/media/libcubeb/fix-crashes.patch @@ -0,0 +1,71 @@ +This patch fixes three different crashes, one crash per chunk in this patch, +in the same order. +- Bug 1342389 +- Bug 1345147 +- Bug 1347453 + +diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp +--- a/media/libcubeb/src/cubeb_wasapi.cpp ++++ b/media/libcubeb/src/cubeb_wasapi.cpp +@@ -878,16 +878,23 @@ wasapi_stream_render_loop(LPVOID stream) + + /* WaitForMultipleObjects timeout can trigger in cases where we don't want to + treat it as a timeout, such as across a system sleep/wake cycle. Trigger + the timeout error handling only when the timeout_limit is reached, which is + reset on each successful loop. */ + unsigned timeout_count = 0; + const unsigned timeout_limit = 5; + while (is_playing) { ++ // We want to check the emergency bailout variable before a ++ // and after the WaitForMultipleObject, because the handles WaitForMultipleObjects ++ // is going to wait on might have been closed already. ++ if (*emergency_bailout) { ++ delete emergency_bailout; ++ return 0; ++ } + DWORD waitResult = WaitForMultipleObjects(ARRAY_LENGTH(wait_array), + wait_array, + FALSE, + 1000); + if (*emergency_bailout) { + delete emergency_bailout; + return 0; + } +@@ -1199,16 +1206,22 @@ bool stop_and_join_render_thread(cubeb_s + { + bool rv = true; + LOG("Stop and join render thread."); + if (!stm->thread) { + LOG("No thread present."); + return true; + } + ++ // If we've already leaked the thread, just return, ++ // there is not much we can do. ++ if (!stm->emergency_bailout.load()) { ++ return false; ++ } ++ + BOOL ok = SetEvent(stm->shutdown_event); + if (!ok) { + LOG("Destroy SetEvent failed: %lx", GetLastError()); + } + + /* Wait five seconds for the rendering thread to return. It's supposed to + * check its event loop very often, five seconds is rather conservative. */ + DWORD r = WaitForSingleObject(stm->thread, 5000); +diff --git a/media/libcubeb/update.sh b/media/libcubeb/update.sh +--- a/media/libcubeb/update.sh ++++ b/media/libcubeb/update.sh +@@ -66,8 +66,11 @@ fi + echo "Applying a patch on top of $version" + patch -p1 < ./wasapi-drift-fix-passthrough-resampler.patch + + echo "Applying a patch on top of $version" + patch -p1 < ./audiounit-drift-fix.patch + + echo "Applying a patch on top of $version" + patch -p1 < ./uplift-wasapi-fixes-aurora.patch ++ ++echo "Applying a patch on top of $version" ++patch -p3 < ./fix-crashes.patch |