зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1476278
- Update libcubeb to revision 6c47043. r=jya
MozReview-Commit-ID: K03bJy6rSJ1 --HG-- extra : rebase_source : 5c6a927f1388d43071330cc139e22fee72ad46d2
This commit is contained in:
Родитель
71c71f1730
Коммит
7b70359220
|
@ -1,68 +0,0 @@
|
|||
From 59f5cb4ba01f21c4ad87e9404d1e470408e18505 Mon Sep 17 00:00:00 2001
|
||||
From: Jean-Yves Avenard <jyavenard@mozilla.com>
|
||||
Date: Mon, 9 Jul 2018 17:37:16 +0200
|
||||
Subject: [PATCH 1/2] Correctly retrieve the output layout on macOS < 10.12.
|
||||
|
||||
The method kAudioUnitProperty_AudioChannelLayout used to retrieve the channel layout wasn't introduced until 10.12. So we use kAudioDevicePropertyPreferredChannelLayout instead should it fails.
|
||||
|
||||
Fixes #448
|
||||
---
|
||||
src/cubeb_audiounit.cpp | 35 ++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 34 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp
|
||||
index 6163ed7..43120b3 100644
|
||||
--- a/src/cubeb_audiounit.cpp
|
||||
+++ b/src/cubeb_audiounit.cpp
|
||||
@@ -1239,6 +1239,38 @@ audiounit_convert_channel_layout(AudioChannelLayout * layout)
|
||||
return cl;
|
||||
}
|
||||
|
||||
+static cubeb_channel_layout
|
||||
+audiounit_get_preferred_channel_layout(AudioUnit output_unit)
|
||||
+{
|
||||
+ OSStatus rv = noErr;
|
||||
+ UInt32 size = 0;
|
||||
+ rv = AudioUnitGetPropertyInfo(output_unit,
|
||||
+ kAudioDevicePropertyPreferredChannelLayout,
|
||||
+ kAudioUnitScope_Output,
|
||||
+ AU_OUT_BUS,
|
||||
+ &size,
|
||||
+ nullptr);
|
||||
+ if (rv != noErr) {
|
||||
+ LOG("AudioUnitGetPropertyInfo/kAudioDevicePropertyPreferredChannelLayout rv=%d", rv);
|
||||
+ return CUBEB_LAYOUT_UNDEFINED;
|
||||
+ }
|
||||
+ assert(size > 0);
|
||||
+
|
||||
+ auto layout = make_sized_audio_channel_layout(size);
|
||||
+ rv = AudioUnitGetProperty(output_unit,
|
||||
+ kAudioDevicePropertyPreferredChannelLayout,
|
||||
+ kAudioUnitScope_Output,
|
||||
+ AU_OUT_BUS,
|
||||
+ layout.get(),
|
||||
+ &size);
|
||||
+ if (rv != noErr) {
|
||||
+ LOG("AudioUnitGetProperty/kAudioDevicePropertyPreferredChannelLayout rv=%d", rv);
|
||||
+ return CUBEB_LAYOUT_UNDEFINED;
|
||||
+ }
|
||||
+
|
||||
+ return audiounit_convert_channel_layout(layout.get());
|
||||
+}
|
||||
+
|
||||
static cubeb_channel_layout
|
||||
audiounit_get_current_channel_layout(AudioUnit output_unit)
|
||||
{
|
||||
@@ -1252,7 +1284,8 @@ audiounit_get_current_channel_layout(AudioUnit output_unit)
|
||||
nullptr);
|
||||
if (rv != noErr) {
|
||||
LOG("AudioUnitGetPropertyInfo/kAudioUnitProperty_AudioChannelLayout rv=%d", rv);
|
||||
- return CUBEB_LAYOUT_UNDEFINED;
|
||||
+ // This property isn't known before macOS 10.12, attempt another method.
|
||||
+ return audiounit_get_preferred_channel_layout(output_unit);
|
||||
}
|
||||
assert(size > 0);
|
||||
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp
|
||||
index 43120b3..5a83098 100644
|
||||
--- a/src/cubeb_audiounit.cpp
|
||||
+++ b/src/cubeb_audiounit.cpp
|
||||
@@ -291,7 +291,7 @@ cubeb_channel_to_channel_label(cubeb_channel channel)
|
||||
case CHANNEL_TOP_BACK_RIGHT:
|
||||
return kAudioChannelLabel_TopBackRight;
|
||||
default:
|
||||
- return CHANNEL_UNKNOWN;
|
||||
+ return kAudioChannelLabel_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1232,8 +1232,12 @@ audiounit_convert_channel_layout(AudioChannelLayout * layout)
|
||||
|
||||
cubeb_channel_layout cl = 0;
|
||||
for (UInt32 i = 0; i < layout->mNumberChannelDescriptions; ++i) {
|
||||
- cl |= channel_label_to_cubeb_channel(
|
||||
+ cubeb_channel cc = channel_label_to_cubeb_channel(
|
||||
layout->mChannelDescriptions[i].mChannelLabel);
|
||||
+ if (cc == CHANNEL_UNKNOWN) {
|
||||
+ return CUBEB_LAYOUT_UNDEFINED;
|
||||
+ }
|
||||
+ cl |= cc;
|
||||
}
|
||||
|
||||
return cl;
|
||||
diff --git a/src/cubeb_mixer.cpp b/src/cubeb_mixer.cpp
|
||||
index 8995c55..c95fef6 100644
|
||||
--- a/src/cubeb_mixer.cpp
|
||||
+++ b/src/cubeb_mixer.cpp
|
||||
@@ -525,6 +525,19 @@ struct cubeb_mixer
|
||||
{
|
||||
if (_context._in_ch_count <= _context._out_ch_count) {
|
||||
// Not enough channels to copy, fill the gaps with silence.
|
||||
+ if (_context._in_ch_count == 1 && _context._out_ch_count >= 2) {
|
||||
+ // Special case for upmixing mono input to stereo and more. We will
|
||||
+ // duplicate the mono channel to the first two channels. On most system,
|
||||
+ // the first two channels are for left and right. It is commonly
|
||||
+ // expected that mono will on both left+right channels
|
||||
+ for (uint32_t i = 0; i < frames; i++) {
|
||||
+ output_buffer[0] = output_buffer[1] = *input_buffer;
|
||||
+ PodZero(output_buffer + 2, _context._out_ch_count - 2);
|
||||
+ output_buffer += _context._out_ch_count;
|
||||
+ input_buffer++;
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
for (uint32_t i = 0; i < frames; i++) {
|
||||
PodCopy(output_buffer, input_buffer, _context._in_ch_count);
|
||||
output_buffer += _context._in_ch_count;
|
|
@ -5,4 +5,4 @@ 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 2968cba6474822535275225e4583c67c6aaaf2ae (2018-06-26 10:58:56 +0200)
|
||||
The git commit ID used was 6c4704304288c45d8198173ac4a6fe27d82b1e7c (2018-07-17 15:23:38 +0200)
|
||||
|
|
|
@ -193,7 +193,10 @@ cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
|
|||
/* process the input, and present exactly `output_frames_needed` in the
|
||||
* callback. */
|
||||
input_processor->input(input_buffer, *input_frames_count);
|
||||
resampled_input = input_processor->output(resampled_frame_count, (size_t*)input_frames_count);
|
||||
|
||||
size_t frames_resampled = 0;
|
||||
resampled_input = input_processor->output(resampled_frame_count, &frames_resampled);
|
||||
*input_frames_count = frames_resampled;
|
||||
|
||||
long got = data_callback(stream, user_ptr,
|
||||
resampled_input, nullptr, resampled_frame_count);
|
||||
|
@ -244,8 +247,11 @@ cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
|
|||
/* process the input, and present exactly `output_frames_needed` in the
|
||||
* callback. */
|
||||
input_processor->input(in_buffer, *input_frames_count);
|
||||
|
||||
size_t frames_resampled = 0;
|
||||
resampled_input =
|
||||
input_processor->output(output_frames_before_processing, (size_t*)input_frames_count);
|
||||
input_processor->output(output_frames_before_processing, &frames_resampled);
|
||||
*input_frames_count = frames_resampled;
|
||||
} else {
|
||||
resampled_input = nullptr;
|
||||
}
|
||||
|
|
|
@ -82,9 +82,3 @@ patch -p3 < prefer-pulse-rust.patch
|
|||
|
||||
echo "Applying disable-device-switching.patch on top of $rev"
|
||||
patch -p3 < disable-device-switching.patch
|
||||
|
||||
echo "Applying Correctly-retrieve-the-output-layout-on-macOS-10.12.patch on top of $rev"
|
||||
patch -p1 < 0001-Correctly-retrieve-the-output-layout-on-macOS-10.12.patch
|
||||
|
||||
echo "Applying Always-upmix-mono-to-the-first-two-channels-if-enoug.patch on top of $rev"
|
||||
patch -p1 < 0002-Always-upmix-mono-to-the-first-two-channels-if-enoug.patch
|
||||
|
|
Загрузка…
Ссылка в новой задаче