Chromium Code Reviews| 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..e8e666d6af874efa98d530afb74a8294fdb948ae 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,10 @@ void MediaPlayerBridge::OnMediaPrepared() { |
| // If media player was recovered from a saved state, consume all the pending |
| // events. |
| - PendingSeekInternal(pending_seek_); |
| + // if (pending_seek_.InMilliseconds() >= 0) { |
|
qinmin
2014/10/20 17:16:19
cannot we just change this line to > 0 and it will
whywhat
2014/10/20 18:41:35
Some websites actually do call video.seekTo(0) bef
qinmin
2014/10/20 21:44:52
remove this comments, it is not helpful for unders
dgn
2014/10/21 10:07:18
Done.
|
| + if (should_seek_on_prepare_) { |
| + PendingSeekInternal(pending_seek_); |
|
whywhat
2014/10/20 18:41:35
should we reset pending_seek_ to 0 and should_seek
dgn
2014/10/21 10:07:18
Done.
|
| + } |
|
whywhat
2014/10/20 18:41:35
nit: no need for curly braces here
dgn
2014/10/21 10:07:17
They are needed now.
|
| if (pending_play_) { |
| StartInternal(); |