summaryrefslogtreecommitdiffstats
path: root/media/libcubeb/uplift-part-of-f07ee6d-esr52.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 14:14:26 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 14:14:26 -0500
commit1960d6e08a949ceed50e6a18240d40a7ecee879c (patch)
tree580b06d4df15ff5f8a9c3f20468bf2160ac666e5 /media/libcubeb/uplift-part-of-f07ee6d-esr52.patch
parent732fe36241032a1793e09209ccc06cb720225b9e (diff)
downloadUXP-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/uplift-part-of-f07ee6d-esr52.patch')
-rw-r--r--media/libcubeb/uplift-part-of-f07ee6d-esr52.patch167
1 files changed, 167 insertions, 0 deletions
diff --git a/media/libcubeb/uplift-part-of-f07ee6d-esr52.patch b/media/libcubeb/uplift-part-of-f07ee6d-esr52.patch
new file mode 100644
index 000000000..0eb1aca82
--- /dev/null
+++ b/media/libcubeb/uplift-part-of-f07ee6d-esr52.patch
@@ -0,0 +1,167 @@
+# HG changeset patch
+# User Alex Chronopoulos <achronop@gmail.com>
+# Parent 00c051cd38c7a6cb3178fd0890d52056f83abfdc
+Bug 1345049 - Uplift part of cubeb upstream f07ee6d to esr52. r=padenot. a=xxxxxx
+
+diff --git a/media/libcubeb/src/cubeb_audiounit.cpp b/media/libcubeb/src/cubeb_audiounit.cpp
+--- a/media/libcubeb/src/cubeb_audiounit.cpp
++++ b/media/libcubeb/src/cubeb_audiounit.cpp
+@@ -590,33 +590,43 @@ audiounit_get_input_device_id(AudioDevic
+ device_id);
+ if (r != noErr) {
+ return CUBEB_ERROR;
+ }
+
+ return CUBEB_OK;
+ }
+
++static int audiounit_stream_get_volume(cubeb_stream * stm, float * volume);
++static int audiounit_stream_set_volume(cubeb_stream * stm, float volume);
++
+ static int
+ audiounit_reinit_stream(cubeb_stream * stm, bool is_started)
+ {
++ auto_lock context_lock(stm->context->mutex);
+ if (is_started) {
+ audiounit_stream_stop_internal(stm);
+ }
+
+ {
+ auto_lock lock(stm->mutex);
++ float volume = 0.0;
++ int vol_rv = audiounit_stream_get_volume(stm, &volume);
+
+ audiounit_close_stream(stm);
+
+ if (audiounit_setup_stream(stm) != CUBEB_OK) {
+ LOG("(%p) Stream reinit failed.", stm);
+ return CUBEB_ERROR;
+ }
+
++ if (vol_rv == CUBEB_OK) {
++ audiounit_stream_set_volume(stm, volume);
++ }
++
+ // Reset input frames to force new stream pre-buffer
+ // silence if needed, check `is_extra_input_needed()`
+ stm->frames_read = 0;
+
+ // If the stream was running, start it again.
+ if (is_started) {
+ audiounit_stream_start_internal(stm);
+ }
+@@ -1007,20 +1017,22 @@ audiounit_get_preferred_sample_rate(cube
+ static OSStatus audiounit_remove_device_listener(cubeb * context);
+
+ static void
+ audiounit_destroy(cubeb * ctx)
+ {
+ // Disabling this assert for bug 1083664 -- we seem to leak a stream
+ // assert(ctx->active_streams == 0);
+
+- /* Unregister the callback if necessary. */
+- if(ctx->collection_changed_callback) {
++ {
+ auto_lock lock(ctx->mutex);
+- audiounit_remove_device_listener(ctx);
++ /* Unregister the callback if necessary. */
++ if(ctx->collection_changed_callback) {
++ audiounit_remove_device_listener(ctx);
++ }
+ }
+
+ ctx->~cubeb();
+ free(ctx);
+ }
+
+ static void audiounit_stream_destroy(cubeb_stream * stm);
+
+@@ -1861,17 +1873,17 @@ audiounit_close_stream(cubeb_stream *stm
+ cubeb_resampler_destroy(stm->resampler);
+ }
+
+ static void
+ audiounit_stream_destroy(cubeb_stream * stm)
+ {
+ stm->shutdown = true;
+
+- auto_lock context_locl(stm->context->mutex);
++ auto_lock context_lock(stm->context->mutex);
+ audiounit_stream_stop_internal(stm);
+
+ {
+ auto_lock lock(stm->mutex);
+ audiounit_close_stream(stm);
+ }
+
+ #if !TARGET_OS_IPHONE
+@@ -1905,17 +1917,17 @@ audiounit_stream_start_internal(cubeb_st
+ }
+
+ static int
+ audiounit_stream_start(cubeb_stream * stm)
+ {
+ stm->shutdown = false;
+ stm->draining = false;
+
+- auto_lock context_locl(stm->context->mutex);
++ auto_lock context_lock(stm->context->mutex);
+ audiounit_stream_start_internal(stm);
+
+ stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STARTED);
+
+ LOG("Cubeb stream (%p) started successfully.", stm);
+ return CUBEB_OK;
+ }
+
+@@ -1933,17 +1945,17 @@ audiounit_stream_stop_internal(cubeb_str
+ }
+ }
+
+ static int
+ audiounit_stream_stop(cubeb_stream * stm)
+ {
+ stm->shutdown = true;
+
+- auto_lock context_locl(stm->context->mutex);
++ auto_lock context_lock(stm->context->mutex);
+ audiounit_stream_stop_internal(stm);
+
+ stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STOPPED);
+
+ LOG("Cubeb stream (%p) stopped successfully.", stm);
+ return CUBEB_OK;
+ }
+
+@@ -2030,16 +2042,31 @@ audiounit_stream_get_latency(cubeb_strea
+ }
+
+ *latency = stm->hw_latency_frames + stm->current_latency_frames;
+
+ return CUBEB_OK;
+ #endif
+ }
+
++static int
++audiounit_stream_get_volume(cubeb_stream * stm, float * volume)
++{
++ assert(stm->output_unit);
++ OSStatus r = AudioUnitGetParameter(stm->output_unit,
++ kHALOutputParam_Volume,
++ kAudioUnitScope_Global,
++ 0, volume);
++ if (r != noErr) {
++ LOG("AudioUnitGetParameter/kHALOutputParam_Volume rv=%d", r);
++ return CUBEB_ERROR;
++ }
++ return CUBEB_OK;
++}
++
+ int audiounit_stream_set_volume(cubeb_stream * stm, float volume)
+ {
+ OSStatus r;
+
+ r = AudioUnitSetParameter(stm->output_unit,
+ kHALOutputParam_Volume,
+ kAudioUnitScope_Global,
+ 0, volume, 0);