Chromium Code Reviews| Index: media/audio/audio_output_controller.cc |
| diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc |
| index ae879c2fdc106629d4d4b7b004f91fd79373de00..0589cac9423faa7b970a66474912e7455dd02b67 100644 |
| --- a/media/audio/audio_output_controller.cc |
| +++ b/media/audio/audio_output_controller.cc |
| @@ -16,6 +16,7 @@ |
| #include "base/threading/platform_thread.h" |
| #include "base/time/time.h" |
| #include "base/trace_event/trace_event.h" |
| +#include "media/base/audio_timestamp_helper.h" |
| using base::TimeDelta; |
| @@ -174,7 +175,7 @@ void AudioOutputController::DoPlay() { |
| return; |
| // Ask for first packet. |
| - sync_reader_->UpdatePendingBytes(0, 0); |
| + sync_reader_->PrepareNextData(base::TimeDelta(), base::TimeTicks(), 0); |
| state_ = kPlaying; |
| @@ -227,7 +228,7 @@ void AudioOutputController::DoPause() { |
| // Let the renderer know we've stopped. Necessary to let PPAPI clients know |
| // audio has been shutdown. TODO(dalecurtis): This stinks. PPAPI should have |
| // a better way to know when it should exit PPB_Audio_Shared::Run(). |
| - sync_reader_->UpdatePendingBytes(std::numeric_limits<uint32_t>::max(), 0); |
| + sync_reader_->PrepareNextData(base::TimeDelta::Max(), base::TimeTicks(), 0); |
| handler_->OnPaused(); |
| } |
| @@ -308,12 +309,9 @@ int AudioOutputController::OnMoreData(base::TimeDelta delay, |
| sync_reader_->Read(dest); |
| - const int total_bytes_delay = |
| - delay.InSecondsF() * params_.GetBytesPerSecond(); |
| const int frames = dest->frames(); |
| - sync_reader_->UpdatePendingBytes( |
| - total_bytes_delay + frames * params_.GetBytesPerFrame(), |
|
chcunningham
2016/10/21 18:19:47
Why aren't you adding in the delay for the dest bu
|
| - prior_frames_skipped); |
| + |
| + sync_reader_->PrepareNextData(delay, delay_timestamp, prior_frames_skipped); |
|
chcunningham
2016/10/21 18:19:47
Nit: What do you think about "RequestMoreData"? It
Mikhail
2016/10/24 19:50:24
Agree, "RequestMoreData" is better. thanks!
|
| bool need_to_duplicate = false; |
| { |