From aa5551739a370b9d35b6c90b251b7a59963ada38 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Fri, 8 Feb 2013 14:00:24 +1300 Subject: [PATCH] Bug 839319 - Initialize WAVE_FORMAT_EXTENSIBLE correctly in cubeb winmm backend. r=doublec --- media/libcubeb/README_MOZILLA | 3 ++- media/libcubeb/src/cubeb_winmm.c | 16 +++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/media/libcubeb/README_MOZILLA b/media/libcubeb/README_MOZILLA index f80ab6cb8353..7fb3e765a383 100644 --- a/media/libcubeb/README_MOZILLA +++ b/media/libcubeb/README_MOZILLA @@ -5,4 +5,5 @@ 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 0f53b9b70c4e6af9da4a7eb0d38a7757c5a10edd.. +The git commit ID used was 0f53b9b70c4e6af9da4a7eb0d38a7757c5a10edd. +Plus the single commit e945dbd052793a7faba3e9064d03bd6781b02692. diff --git a/media/libcubeb/src/cubeb_winmm.c b/media/libcubeb/src/cubeb_winmm.c index 0afb3a575e91..5e3d818c4174 100644 --- a/media/libcubeb/src/cubeb_winmm.c +++ b/media/libcubeb/src/cubeb_winmm.c @@ -331,16 +331,8 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n } memset(&wfx, 0, sizeof(wfx)); - if (stream_params.channels > 2) { - wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - wfx.Format.cbSize = sizeof(wfx) - sizeof(wfx.Format); - } else { - wfx.Format.wFormatTag = WAVE_FORMAT_PCM; - if (stream_params.format == CUBEB_SAMPLE_FLOAT32LE) { - wfx.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } - wfx.Format.cbSize = 0; - } + wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfx.Format.cbSize = sizeof(wfx) - sizeof(wfx.Format); wfx.Format.nChannels = stream_params.channels; wfx.Format.nSamplesPerSec = stream_params.rate; @@ -362,9 +354,7 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n wfx.Format.nBlockAlign = (wfx.Format.wBitsPerSample * wfx.Format.nChannels) / 8; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; - wfx.Samples.wValidBitsPerSample = 0; - wfx.Samples.wSamplesPerBlock = 0; - wfx.Samples.wReserved = 0; + wfx.Samples.wValidBitsPerSample = wfx.Format.wBitsPerSample; EnterCriticalSection(&context->lock); /* CUBEB_STREAM_MAX is a horrible hack to avoid a situation where, when