зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1386957 -Update libcubeb to revision 0e103884. r=achronop
MozReview-Commit-ID: HFkJ6TPLIfv --HG-- extra : rebase_source : 19225466d283f999a99589f6afba1315dc1ec041
This commit is contained in:
Родитель
35496c2080
Коммит
b680d61073
|
@ -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 cf622778bbc3d240d7079879fabd2dc945237cbc (2017-07-29 11:28:16 +1200)
|
||||
The git commit ID used was 0e10388459fe1e252c075e4a1fab7a9363dc13a1 (2017-08-03 17:58:06 +1200)
|
||||
|
|
|
@ -1616,7 +1616,8 @@ audiounit_activate_clock_drift_compensation(const AudioDeviceID aggregate_device
|
|||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster };
|
||||
|
||||
for (UInt32 i = 0; i < subdevices_num; ++i) {
|
||||
// Start from the second device since the first is the master clock
|
||||
for (UInt32 i = 1; i < subdevices_num; ++i) {
|
||||
UInt32 drift_compensation_value = 1;
|
||||
rv = AudioObjectSetPropertyData(sub_devices[i],
|
||||
&address_drift,
|
||||
|
@ -1690,6 +1691,9 @@ audiounit_create_aggregate_device(cubeb_stream * stm)
|
|||
static int
|
||||
audiounit_destroy_aggregate_device(AudioObjectID plugin_id, AudioDeviceID * aggregate_device_id)
|
||||
{
|
||||
assert(aggregate_device_id &&
|
||||
*aggregate_device_id != kAudioDeviceUnknown &&
|
||||
plugin_id != kAudioObjectUnknown);
|
||||
AudioObjectPropertyAddress destroy_aggregate_device_addr = { kAudioPlugInDestroyAggregateDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
|
@ -2262,7 +2266,8 @@ audiounit_setup_stream(cubeb_stream * stm)
|
|||
device_info in_dev_info = stm->input_device;
|
||||
device_info out_dev_info = stm->output_device;
|
||||
|
||||
if (has_input(stm) && has_output(stm)) {
|
||||
if (has_input(stm) && has_output(stm) &&
|
||||
stm->input_device.id != stm->output_device.id) {
|
||||
r = audiounit_create_aggregate_device(stm);
|
||||
if (r != CUBEB_OK) {
|
||||
stm->aggregate_device_id = 0;
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
*/
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#ifndef __FreeBSD__
|
||||
#define _POSIX_SOURCE
|
||||
#endif
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -561,11 +561,11 @@ void cubeb_mixer_destroy(cubeb_mixer * mixer)
|
|||
|
||||
void cubeb_mixer_mix(cubeb_mixer * mixer, long frames,
|
||||
void * input_buffer, unsigned long input_buffer_length,
|
||||
void * output_buffer, unsigned long outputput_buffer_length,
|
||||
void * output_buffer, unsigned long output_buffer_length,
|
||||
cubeb_stream_params const * stream_params,
|
||||
cubeb_stream_params const * mixer_params)
|
||||
{
|
||||
assert(mixer);
|
||||
mixer->mix(frames, input_buffer, input_buffer_length, output_buffer, outputput_buffer_length,
|
||||
mixer->mix(frames, input_buffer, input_buffer_length, output_buffer, output_buffer_length,
|
||||
stream_params, mixer_params);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ cubeb_mixer * cubeb_mixer_create(cubeb_sample_format format,
|
|||
void cubeb_mixer_destroy(cubeb_mixer * mixer);
|
||||
void cubeb_mixer_mix(cubeb_mixer * mixer, long frames,
|
||||
void * input_buffer, unsigned long input_buffer_length,
|
||||
void * output_buffer, unsigned long outputput_buffer_length,
|
||||
void * output_buffer, unsigned long output_buffer_length,
|
||||
cubeb_stream_params const * stream_params,
|
||||
cubeb_stream_params const * mixer_params);
|
||||
|
||||
|
|
|
@ -451,8 +451,22 @@ channel_layout_to_mask(cubeb_channel_layout layout)
|
|||
}
|
||||
|
||||
cubeb_channel_layout
|
||||
mask_to_channel_layout(DWORD mask)
|
||||
mask_to_channel_layout(WAVEFORMATEX const * fmt)
|
||||
{
|
||||
DWORD mask = 0;
|
||||
|
||||
if (fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
|
||||
WAVEFORMATEXTENSIBLE const * ext = reinterpret_cast<WAVEFORMATEXTENSIBLE const *>(fmt);
|
||||
mask = ext->dwChannelMask;
|
||||
} else if (fmt->wFormatTag == WAVE_FORMAT_PCM ||
|
||||
fmt->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) {
|
||||
if (fmt->nChannels == 1) {
|
||||
mask = MASK_MONO;
|
||||
} else if (fmt->nChannels == 2) {
|
||||
mask = MASK_STEREO;
|
||||
}
|
||||
}
|
||||
|
||||
switch (mask) {
|
||||
// MASK_DUAL_MONO(_LFE) is same as STEREO(_LFE), so we skip it.
|
||||
case MASK_MONO: return CUBEB_LAYOUT_MONO;
|
||||
|
@ -1368,8 +1382,7 @@ wasapi_get_preferred_channel_layout(cubeb * context, cubeb_channel_layout * layo
|
|||
}
|
||||
com_heap_ptr<WAVEFORMATEX> mix_format(tmp);
|
||||
|
||||
WAVEFORMATEXTENSIBLE * format_pcm = reinterpret_cast<WAVEFORMATEXTENSIBLE *>(mix_format.get());
|
||||
*layout = mask_to_channel_layout(format_pcm->dwChannelMask);
|
||||
*layout = mask_to_channel_layout(mix_format.get());
|
||||
|
||||
LOG("Preferred channel layout: %s", CUBEB_CHANNEL_LAYOUT_MAPS[*layout].name);
|
||||
|
||||
|
@ -1428,6 +1441,7 @@ handle_channel_layout(cubeb_stream * stm, EDataFlow direction, com_heap_ptr<WAV
|
|||
and handle the eventual upmix/downmix ourselves. Ignore the subformat of
|
||||
the suggestion, since it seems to always be IEEE_FLOAT. */
|
||||
LOG("Using WASAPI suggested format: channels: %d", closest->nChannels);
|
||||
XASSERT(closest->wFormatTag == WAVE_FORMAT_EXTENSIBLE);
|
||||
WAVEFORMATEXTENSIBLE * closest_pcm = reinterpret_cast<WAVEFORMATEXTENSIBLE *>(closest);
|
||||
format_pcm->dwChannelMask = closest_pcm->dwChannelMask;
|
||||
mix_format->nChannels = closest->nChannels;
|
||||
|
@ -1436,6 +1450,7 @@ handle_channel_layout(cubeb_stream * stm, EDataFlow direction, com_heap_ptr<WAV
|
|||
/* Not supported, no suggestion. This should not happen, but it does in the
|
||||
field with some sound cards. We restore the mix format, and let the rest
|
||||
of the code figure out the right conversion path. */
|
||||
XASSERT(mix_format->wFormatTag == WAVE_FORMAT_EXTENSIBLE);
|
||||
*reinterpret_cast<WAVEFORMATEXTENSIBLE *>(mix_format.get()) = hw_mix_format;
|
||||
} else if (hr == S_OK) {
|
||||
LOG("Requested format accepted by WASAPI.");
|
||||
|
@ -1514,21 +1529,23 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm,
|
|||
}
|
||||
com_heap_ptr<WAVEFORMATEX> mix_format(tmp);
|
||||
|
||||
WAVEFORMATEXTENSIBLE * format_pcm = reinterpret_cast<WAVEFORMATEXTENSIBLE *>(mix_format.get());
|
||||
mix_format->wBitsPerSample = stm->bytes_per_sample * 8;
|
||||
format_pcm->SubFormat = stm->waveformatextensible_sub_format;
|
||||
if (mix_format->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
|
||||
WAVEFORMATEXTENSIBLE * format_pcm = reinterpret_cast<WAVEFORMATEXTENSIBLE *>(mix_format.get());
|
||||
format_pcm->SubFormat = stm->waveformatextensible_sub_format;
|
||||
}
|
||||
waveformatex_update_derived_properties(mix_format.get());
|
||||
/* Set channel layout only when there're more than two channels. Otherwise,
|
||||
* use the default setting retrieved from the stream format of the audio
|
||||
* engine's internal processing by GetMixFormat. */
|
||||
if (mix_format->nChannels > 2) {
|
||||
handle_channel_layout(stm, direction ,mix_format, stream_params);
|
||||
handle_channel_layout(stm, direction, mix_format, stream_params);
|
||||
}
|
||||
|
||||
mix_params->format = stream_params->format;
|
||||
mix_params->rate = mix_format->nSamplesPerSec;
|
||||
mix_params->channels = mix_format->nChannels;
|
||||
mix_params->layout = mask_to_channel_layout(format_pcm->dwChannelMask);
|
||||
mix_params->layout = mask_to_channel_layout(mix_format.get());
|
||||
if (mix_params->layout == CUBEB_LAYOUT_UNDEFINED) {
|
||||
LOG("Output using undefined layout!\n");
|
||||
} else if (mix_format->nChannels != CUBEB_CHANNEL_LAYOUT_MAPS[mix_params->layout].channels) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче