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

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

Issue 664413002: [Merge to M39][Cast, Android] Skip initial seek to 0 on fling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2171
Patch Set: 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 1022e4ef2b92aef264c3395374614402629f47cc..84a2e108917d78ae50fabb84ca63719ef9b0bc1d 100644
--- a/media/base/android/media_player_bridge.cc
+++ b/media/base/android/media_player_bridge.cc
@@ -37,6 +37,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),
@@ -337,6 +338,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();
@@ -367,8 +369,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());
@@ -415,7 +420,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