Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: media/renderers/audio_renderer_impl.cc

Issue 2237243002: CL for perf tryjob on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698