Bug 1310206 - Uplift a few cubeb one-liners to beta. r=jesup a=ritu
authorRandell Jesup <rjesup@jesup.org>
Tue, 18 Oct 2016 09:18:44 -0400
changeset 350711 fa324ad9a0cb9bc27a2509aef5d220ae46338b8d
parent 350710 3c7b927f4b0bc5fad60390b4fa7d27a05f9f2f1e
child 350712 5302ca3381e460b4de3dbe0d67b442b33be46552
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, ritu
bugs1310206
milestone50.0
Bug 1310206 - Uplift a few cubeb one-liners to beta. r=jesup a=ritu Correct beta patch, Backed out changeset 3c7b927f4b0b (bug 1310206)
media/libcubeb/src/cubeb_resampler.cpp
media/libcubeb/src/cubeb_wasapi.cpp
--- a/media/libcubeb/src/cubeb_resampler.cpp
+++ b/media/libcubeb/src/cubeb_resampler.cpp
@@ -150,17 +150,17 @@ cubeb_resampler_speex<T, InputProcessor,
   * callback, drain the processors. */
   return output_processor->output(output_buffer, output_frames_needed);
 }
 
 template<typename T, typename InputProcessor, typename OutputProcessor>
 long
 cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
 ::fill_internal_input(T * input_buffer, long * input_frames_count,
-                      T * output_buffer, long output_frames_needed)
+                      T * output_buffer, long /*output_frames_needed*/)
 {
   assert(input_buffer && input_frames_count && *input_frames_count &&
          !output_buffer);
 
   /* The input data, after eventual resampling. This is passed to the callback. */
   T * resampled_input = nullptr;
   uint32_t resampled_frame_count = input_processor->output_for_input(*input_frames_count);
 
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -754,18 +754,20 @@ refill_callback_output(cubeb_stream * st
     return true;
   }
 
   long got = refill(stm,
                     nullptr,
                     0,
                     output_buffer,
                     output_frames);
+  XASSERT(got >= 0);
+  XASSERT(got == output_frames || stm->draining);
 
-  hr = stm->render_client->ReleaseBuffer(output_frames, 0);
+  hr = stm->render_client->ReleaseBuffer(got, 0);
   if (FAILED(hr)) {
     LOG("failed to release buffer: %x\n", hr);
     return false;
   }
 
   return got == output_frames || stm->draining;
 }
 
@@ -1016,17 +1018,17 @@ current_stream_delay(cubeb_stream * stm)
   if (FAILED(hr)) {
     LOG("GetPosition failed: %x\n", hr);
     return 0;
   }
 
   double cur_pos = static_cast<double>(pos) / freq;
   double max_pos = static_cast<double>(stm->frames_written)  / stm->output_mix_params.rate;
   double delay = max_pos - cur_pos;
-  XASSERT(delay >= 0 || stm->draining);
+  XASSERT(delay >= 0);
 
   return delay;
 }
 
 int
 stream_set_volume(cubeb_stream * stm, float volume)
 {
   stm->stream_reset_lock.assert_current_thread_owns();