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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2239243002: Interpolate media time for mojo rendering pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moves media-time clamping to PipelineImpl Created 4 years, 3 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 | « no previous file | media/base/android/media_source_player.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 3c1cf551a4bf2fb748b6ca2ff902c1f74b6e2cbf..a12c5c8d45eace138c836d2a5c3572b5c99f98dd 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -850,7 +850,7 @@ void WebMediaPlayerAndroid::OnPlaybackComplete() {
// at a time which is smaller than the duration. This makes webkit never
// know that the playback has finished. To solve this, we set the
// current time to media duration when OnPlaybackComplete() get called.
- interpolator_.SetBounds(duration_, duration_);
+ interpolator_.SetBounds(duration_, duration_, default_tick_clock_.NowTicks());
client_->timeChanged();
// If the loop attribute is set, timeChanged() will update the current time
@@ -887,7 +887,8 @@ void WebMediaPlayerAndroid::OnSeekComplete(
seek(pending_seek_time_.InSecondsF());
return;
}
- interpolator_.SetBounds(current_time, current_time);
+ interpolator_.SetBounds(current_time, current_time,
+ default_tick_clock_.NowTicks());
UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
@@ -981,8 +982,10 @@ void WebMediaPlayerAndroid::OnTimeUpdate(base::TimeDelta current_timestamp,
return;
// Compensate the current_timestamp with the IPC latency.
+ base::TimeTicks now_ticks = default_tick_clock_.NowTicks();
base::TimeDelta lower_bound =
- base::TimeTicks::Now() - current_time_ticks + current_timestamp;
+ now_ticks - current_time_ticks + current_timestamp;
+
base::TimeDelta upper_bound = lower_bound;
// We should get another time update in about |kTimeUpdateInterval|
// milliseconds.
@@ -996,7 +999,7 @@ void WebMediaPlayerAndroid::OnTimeUpdate(base::TimeDelta current_timestamp,
std::max(lower_bound, base::TimeDelta::FromSecondsD(currentTime()));
if (lower_bound > upper_bound)
upper_bound = lower_bound;
- interpolator_.SetBounds(lower_bound, upper_bound);
+ interpolator_.SetBounds(lower_bound, upper_bound, now_ticks);
}
void WebMediaPlayerAndroid::OnConnectedToRemoteDevice(
« no previous file with comments | « no previous file | media/base/android/media_source_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698