Bug 1132034 - Properly round the number of frame for the accumulating clock in WASAPI. r=kinetik
authorPaul Adenot <paul@paul.cx>
Thu, 19 Feb 2015 19:35:06 +1300
changeset 256950 99f5101d6cf18479f300d29725026094db957673
parent 256949 425f602236255e8c0a2f23d08ba6d0aeb7f9cb85
child 256951 35b8aaad1312e40ae4ee57dc924cb47760742361
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1132034
milestone38.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 1132034 - Properly round the number of frame for the accumulating clock in WASAPI. r=kinetik
media/libcubeb/src/cubeb_wasapi.cpp
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -20,16 +20,17 @@
 #include <audioclient.h>
 #include <process.h>
 #include <avrt.h>
 #include "cubeb/cubeb.h"
 #include "cubeb-internal.h"
 #include "cubeb/cubeb-stdint.h"
 #include "cubeb_resampler.h"
 #include <stdio.h>
+#include <cmath>
 
 /**Taken from winbase.h, Not in MinGW.*/
 #ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
 #define STACK_SIZE_PARAM_IS_A_RESERVATION   0x00010000    // Threads only
 #endif
 
 // #define LOGGING_ENABLED
 
@@ -469,17 +470,17 @@ refill(cubeb_stream * stm, float * data,
   if (should_upmix(stm) || should_downmix(stm)) {
     dest = stm->mix_buffer;
   } else {
     dest = data;
   }
 
   long out_frames = cubeb_resampler_fill(stm->resampler, dest, frames_needed);
 
-  clock_add(stm, frames_needed * stream_to_mix_samplerate_ratio(stm));
+  clock_add(stm, roundf(frames_needed * stream_to_mix_samplerate_ratio(stm)));
 
   /* XXX: Handle this error. */
   if (out_frames < 0) {
     assert(false);
   }
 
   /* Go in draining mode if we got fewer frames than requested. */
   if (out_frames < frames_needed) {