Bug 1518106 - Update cubeb from upstream to feec7e2. r=kinetik

Differential Revision: https://phabricator.services.mozilla.com/D17399

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Chronopoulos 2019-01-23 19:36:20 +00:00
Родитель b61d90492b
Коммит 46289fa2a3
2 изменённых файлов: 31 добавлений и 2 удалений

Просмотреть файл

@ -19,5 +19,5 @@ origin:
license: "ISC"
# update.sh will update this value
release: "67d37c16be84fcc469531d4b6f70eae8a2867a66 (2019-01-21 14:41:14 +0200)"
release: "feec7e2e893c6dc4188fcb95e15dcf8c19890f46 (2019-01-23 17:15:35 +0200)"

Просмотреть файл

@ -85,6 +85,7 @@
X(pa_context_subscribe) \
X(pa_mainloop_api_once) \
X(pa_get_library_version) \
X(pa_channel_map_init_auto) \
#define MAKE_TYPEDEF(x) static typeof(x) * cubeb_##x;
LIBPULSE_API_VISIT(MAKE_TYPEDEF);
@ -786,6 +787,25 @@ to_pulse_format(cubeb_sample_format format)
}
}
static cubeb_channel_layout
pulse_default_layout_for_channels(uint32_t ch)
{
assert (ch > 0 && ch <= 8);
switch (ch) {
case 1: return CUBEB_LAYOUT_MONO;
case 2: return CUBEB_LAYOUT_STEREO;
case 3: return CUBEB_LAYOUT_3F;
case 4: return CUBEB_LAYOUT_QUAD;
case 5: return CUBEB_LAYOUT_3F2;
case 6: return CUBEB_LAYOUT_3F_LFE |
CHANNEL_SIDE_LEFT | CHANNEL_SIDE_RIGHT;
case 7: return CUBEB_LAYOUT_3F3R_LFE;
case 8: return CUBEB_LAYOUT_3F4_LFE;
}
// Never get here!
return CUBEB_LAYOUT_UNDEFINED;
}
static int
create_pa_stream(cubeb_stream * stm,
pa_stream ** pa_stm,
@ -809,7 +829,16 @@ create_pa_stream(cubeb_stream * stm,
ss.channels = stream_params->channels;
if (stream_params->layout == CUBEB_LAYOUT_UNDEFINED) {
*pa_stm = WRAP(pa_stream_new)(stm->context->context, stream_name, &ss, NULL);
pa_channel_map cm;
if (stream_params->channels <= 8 &&
!WRAP(pa_channel_map_init_auto)(&cm, stream_params->channels, PA_CHANNEL_MAP_DEFAULT)) {
LOG("Layout undefined and PulseAudio's default layout has not been configured, guess one.");
layout_to_channel_map(pulse_default_layout_for_channels(stream_params->channels), &cm);
*pa_stm = WRAP(pa_stream_new)(stm->context->context, stream_name, &ss, &cm);
} else {
LOG("Layout undefined, PulseAudio will use its default.");
*pa_stm = WRAP(pa_stream_new)(stm->context->context, stream_name, &ss, NULL);
}
} else {
pa_channel_map cm;
layout_to_channel_map(stream_params->layout, &cm);