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

Unified Diff: media/base/android/media_player_bridge.cc

Issue 654203005: Skip initial seek to 0 on fling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 6 years, 2 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/base/android/media_player_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_player_bridge.cc
diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc
index 432042ed25ac2b8c9ceeee3865f3c199eaf9e678..37ea8c128a772bdb6655f5e09c06d52dd7d464a5 100644
--- a/media/base/android/media_player_bridge.cc
+++ b/media/base/android/media_player_bridge.cc
@@ -38,6 +38,7 @@ MediaPlayerBridge::MediaPlayerBridge(
frame_url),
prepared_(false),
pending_play_(false),
+ should_seek_on_prepare_(false),
url_(url),
first_party_for_cookies_(first_party_for_cookies),
user_agent_(user_agent),
@@ -338,6 +339,7 @@ int MediaPlayerBridge::GetVideoHeight() {
void MediaPlayerBridge::SeekTo(base::TimeDelta timestamp) {
// Record the time to seek when OnMediaPrepared() is called.
pending_seek_ = timestamp;
+ should_seek_on_prepare_ = true;
if (j_media_player_bridge_.is_null())
Prepare();
@@ -369,8 +371,11 @@ void MediaPlayerBridge::Release() {
return;
time_update_timer_.Stop();
- if (prepared_)
+ if (prepared_) {
pending_seek_ = GetCurrentTime();
+ should_seek_on_prepare_ = true;
+ }
+
prepared_ = false;
pending_play_ = false;
SetVideoSurface(gfx::ScopedJavaSurface());
@@ -417,7 +422,11 @@ void MediaPlayerBridge::OnMediaPrepared() {
// If media player was recovered from a saved state, consume all the pending
// events.
- PendingSeekInternal(pending_seek_);
+ if (should_seek_on_prepare_) {
+ PendingSeekInternal(pending_seek_);
+ pending_seek_ = base::TimeDelta::FromMilliseconds(0);
+ should_seek_on_prepare_ = false;
+ }
if (pending_play_) {
StartInternal();
« no previous file with comments | « media/base/android/media_player_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698