| Index: media/renderers/audio_renderer_impl.cc
|
| diff --git a/media/renderers/audio_renderer_impl.cc b/media/renderers/audio_renderer_impl.cc
|
| index afd298b657701e96f52946849041fb91d08d9d19..715ae2a8b8dec6442bc17a690e32b104f16f9320 100644
|
| --- a/media/renderers/audio_renderer_impl.cc
|
| +++ b/media/renderers/audio_renderer_impl.cc
|
| @@ -181,15 +181,17 @@ void AudioRendererImpl::SetMediaTime(base::TimeDelta time) {
|
| audio_clock_.reset(new AudioClock(time, audio_parameters_.sample_rate()));
|
| }
|
|
|
| -base::TimeDelta AudioRendererImpl::CurrentMediaTime() {
|
| +base::TimeDelta AudioRendererImpl::CurrentMediaTime(
|
| + base::TimeTicks* reference) {
|
| base::AutoLock auto_lock(lock_);
|
|
|
| // Return the current time based on the known extents of the rendered audio
|
| // data plus an estimate based on the last time those values were calculated.
|
| + base::TimeTicks now_ticks;
|
| base::TimeDelta current_media_time = audio_clock_->front_timestamp();
|
| if (!last_render_time_.is_null()) {
|
| - current_media_time +=
|
| - (tick_clock_->NowTicks() - last_render_time_) * playback_rate_;
|
| + now_ticks = tick_clock_->NowTicks();
|
| + current_media_time += (now_ticks - last_render_time_) * playback_rate_;
|
| if (current_media_time > audio_clock_->back_timestamp())
|
| current_media_time = audio_clock_->back_timestamp();
|
| }
|
| @@ -203,11 +205,16 @@ base::TimeDelta AudioRendererImpl::CurrentMediaTime() {
|
| if (current_media_time < last_media_timestamp_) {
|
| DVLOG(2) << __func__ << ": " << last_media_timestamp_
|
| << " (clamped), actual: " << current_media_time;
|
| - return last_media_timestamp_;
|
| + current_media_time = last_media_timestamp_;
|
| + } else {
|
| + last_media_timestamp_ = current_media_time;
|
| + }
|
| +
|
| + if (reference) {
|
| + *reference = now_ticks.is_null() ? tick_clock_->NowTicks() : now_ticks;
|
| }
|
|
|
| DVLOG(2) << __func__ << ": " << current_media_time;
|
| - last_media_timestamp_ = current_media_time;
|
| return current_media_time;
|
| }
|
|
|
|
|