Chromium Code Reviews| Index: media/audio/audio_output_device.cc |
| diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc |
| index 3af32b7835f8f1f8a23c98b0a0a16f7fa4deb31c..ac1ec83a9d230c530608675fb482d8ea7919392c 100644 |
| --- a/media/audio/audio_output_device.cc |
| +++ b/media/audio/audio_output_device.cc |
| @@ -413,8 +413,8 @@ void AudioOutputDevice::AudioThreadCallback::MapSharedMemory() { |
| // Called whenever we receive notifications about pending data. |
| void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data) { |
| - // Convert the number of pending bytes in the render buffer into milliseconds. |
| - uint32_t audio_delay_milliseconds = pending_data / bytes_per_ms_; |
| + // Convert the number of pending bytes in the render buffer into frames. |
| + double frames_delayed = static_cast<double>(pending_data) / bytes_per_frame_; |
| callback_num_++; |
| TRACE_EVENT1("audio", "AudioOutputDevice::FireRenderCallback", |
| @@ -433,11 +433,15 @@ void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data) { |
| uint32_t frames_skipped = buffer->params.frames_skipped; |
| buffer->params.frames_skipped = 0; |
| + DVLOG(4) << __FUNCTION__ << " pending_data:" << pending_data |
| + << " frames_delayed(pre-round):" << frames_delayed |
| + << " frames_skipped:" << frames_skipped; |
| + |
| // Update the audio-delay measurement, inform about the number of skipped |
| // frames, and ask client to render audio. Since |output_bus_| is wrapping |
| // the shared memory the Render() call is writing directly into the shared |
| // memory. |
| - render_callback_->Render(output_bus_.get(), audio_delay_milliseconds, |
| + render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
|
DaleCurtis
2016/02/11 01:57:15
You can also just use frames_delayed + 0.5 since t
chcunningham
2016/02/11 21:02:52
Ack. If you don't object I prefer round though...
|
| frames_skipped); |
| } |