Bug 839319 - Initialize WAVE_FORMAT_EXTENSIBLE correctly in cubeb winmm backend. r=doublec
authorMatthew Gregan <kinetik@flim.org>
Fri, 08 Feb 2013 14:00:24 +1300
changeset 121484 0b521694bdbc5a807e9b476b9dc3583561c4428f
parent 121483 f8beba959a1c96466c407496018143bfcf66b0de
child 121485 167195a95601cddc60564bb110e002a3f65099fb
push id24291
push userryanvm@gmail.com
push dateMon, 11 Feb 2013 19:12:51 +0000
treeherdermozilla-central@93ba23f414ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec
bugs839319
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 839319 - Initialize WAVE_FORMAT_EXTENSIBLE correctly in cubeb winmm backend. r=doublec
media/libcubeb/README_MOZILLA
media/libcubeb/src/cubeb_winmm.c
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,9 @@
 The source from this directory was copied from the cubeb 
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 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.
--- a/media/libcubeb/src/cubeb_winmm.c
+++ b/media/libcubeb/src/cubeb_winmm.c
@@ -326,26 +326,18 @@ cubeb_stream_init(cubeb * context, cubeb
 
   if (stream_params.rate < 1 || stream_params.rate > 192000 ||
       stream_params.channels < 1 || stream_params.channels > 32 ||
       latency < 1 || latency > 2000) {
     return CUBEB_ERROR_INVALID_FORMAT;
   }
 
   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;
 
   /* XXX fix channel mappings */
   wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
 
   switch (stream_params.format) {
   case CUBEB_SAMPLE_S16LE:
@@ -357,19 +349,17 @@ cubeb_stream_init(cubeb * context, cubeb
     wfx.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
     break;
   default:
     return CUBEB_ERROR_INVALID_FORMAT;
   }
 
   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
      many streams are active at once, a subset of them will not consume (via
      playback) or release (via waveOutReset) their buffers. */
   if (context->active_streams >= CUBEB_STREAM_MAX) {
     LeaveCriticalSection(&context->lock);
     return CUBEB_ERROR;