Bug 899050, 900380 - Update cubeb. r=kinetik

Update cubeb to pick up three WASAPI fixes:
- This fixes the resampling path when playing on a surround setup
- Also fixes mono playback on a surround setup.
- Fix a weird crash where the struct we get out of GetMixFormat was not of the
  right type.

--HG--
extra : rebase_source : c5b62032a88a3c1379a33d12510944cc11f51184
This commit is contained in:
Paul Adenot 2013-08-08 19:48:18 +02:00
Родитель 0fdeed96a8
Коммит 54f5b5ae26
2 изменённых файлов: 15 добавлений и 4 удалений

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

@ -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 5beac74eab38b7026404888a8cee7675017c7407.
The git commit ID used was 36659a5649fb31c180c39e70ea761e00354c0106.

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

@ -168,6 +168,9 @@ upmix(T * in, long inframes, T * out, int32_t in_channels, int32_t out_channels)
for (long i = 0; i < inframes * in_channels; i+=in_channels) {
for (int j = 0; j < in_channels; j++) {
out[out_index + j] = in[i + j];
if (in_channels == 1) {
out[out_index + j + 1] = in[i + j];
}
}
for (int j = in_channels; j < out_channels; j++) {
out[out_index + j] = 0.0;
@ -181,7 +184,8 @@ upmix(T * in, long inframes, T * out, int32_t in_channels, int32_t out_channels)
static size_t
frame_to_bytes_before_upmix(cubeb_stream * stm, size_t frames)
{
return stm->bytes_per_frame / (should_upmix(stm) ? 2 : 1) * frames;
size_t stream_frame_size = stm->stream_params.channels * sizeof(float);
return stream_frame_size * frames;
}
void
@ -510,8 +514,6 @@ void wasapi_stream_destroy(cubeb_stream * stm);
static void
handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cubeb_stream_params * stream_params)
{
assert((*mix_format)->wFormatTag == WAVE_FORMAT_EXTENSIBLE);
/* Common case: the hardware supports stereo, and the stream is mono or
* stereo. Easy. */
if ((*mix_format)->nChannels == 2 &&
@ -519,6 +521,15 @@ handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cub
return;
}
/* The docs say that GetMixFormat is always of type WAVEFORMATEXTENSIBLE [1],
* so the reinterpret_cast below should be safe. In practice, this is not
* true, and we just want to bail out and let the rest of the code find a good
* conversion path instead of trying to make WASAPI do it by itself.
* [1]: http://msdn.microsoft.com/en-us/library/windows/desktop/dd370811%28v=vs.85%29.aspx*/
if ((*mix_format)->wFormatTag != WAVE_FORMAT_EXTENSIBLE) {
return;
}
/* The hardware is in surround mode, we want to only use front left and front
* right. Try that, and check if it works. */
WAVEFORMATEXTENSIBLE * format_pcm = reinterpret_cast<WAVEFORMATEXTENSIBLE *>((*mix_format));