summaryrefslogtreecommitdiffstats
path: root/media/libcubeb/bug1292803_pulse_assert.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 14:35:17 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 14:35:17 -0500
commita57983a2176afb4bab3c22efa6a24d39f3c11163 (patch)
tree56dbcb66e07d997d817e40c1fd8005ee75142e8b /media/libcubeb/bug1292803_pulse_assert.patch
parent6513e41cb75e64384f35470d59ad6a4f88092e82 (diff)
parent1960d6e08a949ceed50e6a18240d40a7ecee879c (diff)
downloadUXP-a57983a2176afb4bab3c22efa6a24d39f3c11163.tar
UXP-a57983a2176afb4bab3c22efa6a24d39f3c11163.tar.gz
UXP-a57983a2176afb4bab3c22efa6a24d39f3c11163.tar.lz
UXP-a57983a2176afb4bab3c22efa6a24d39f3c11163.tar.xz
UXP-a57983a2176afb4bab3c22efa6a24d39f3c11163.zip
Merge branch 'master' into mailnews-work
Diffstat (limited to 'media/libcubeb/bug1292803_pulse_assert.patch')
-rw-r--r--media/libcubeb/bug1292803_pulse_assert.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/media/libcubeb/bug1292803_pulse_assert.patch b/media/libcubeb/bug1292803_pulse_assert.patch
new file mode 100644
index 000000000..8dee88777
--- /dev/null
+++ b/media/libcubeb/bug1292803_pulse_assert.patch
@@ -0,0 +1,46 @@
+commit 2c7617f5ca20b764c605e19af490889c761e65e2
+Author: Matthew Gregan <kinetik@flim.org>
+Date: Thu Nov 10 19:07:07 2016 +1300
+
+ pulse: Bail early from pulse_defer_event_cb when shutting down.
+
+ When starting a stream, trigger_user_callback may be called from
+ stream_write_callback and immediately enter a drain situation, creating
+ a drain timer and setting shutdown to true. If pulse_defer_event_cb
+ then runs without checking for shutdown, it can overwrite the current
+ timer with a new timer, resulting in a leaked timer and a null pointer
+ assertion.
+
+diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c
+index 5b61bda..86f2ba3 100644
+--- a/src/cubeb_pulse.c
++++ b/src/cubeb_pulse.c
+@@ -181,9 +181,9 @@ static void
+ stream_drain_callback(pa_mainloop_api * a, pa_time_event * e, struct timeval const * tv, void * u)
+ {
+ (void)a;
+- (void)e;
+ (void)tv;
+ cubeb_stream * stm = u;
++ assert(stm->drain_timer == e);
+ stream_state_change_callback(stm, CUBEB_STATE_DRAINED);
+ /* there's no pa_rttime_free, so use this instead. */
+ a->time_free(stm->drain_timer);
+@@ -267,6 +267,7 @@ trigger_user_callback(pa_stream * s, void const * input_data, size_t nbytes, cub
+ assert(r == 0 || r == -PA_ERR_NODATA);
+ /* pa_stream_drain is useless, see PA bug# 866. this is a workaround. */
+ /* arbitrary safety margin: double the current latency. */
++ assert(!stm->drain_timer);
+ stm->drain_timer = WRAP(pa_context_rttime_new)(stm->context->context, WRAP(pa_rtclock_now)() + 2 * latency, stream_drain_callback, stm);
+ stm->shutdown = 1;
+ return;
+@@ -851,6 +852,9 @@ pulse_defer_event_cb(pa_mainloop_api * a, void * userdata)
+ {
+ (void)a;
+ cubeb_stream * stm = userdata;
++ if (stm->shutdown) {
++ return;
++ }
+ size_t writable_size = WRAP(pa_stream_writable_size)(stm->output_stream);
+ trigger_user_callback(stm->output_stream, NULL, writable_size, stm);
+ }