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

Side by Side Diff: content/browser/media/android/media_player_renderer.cc

Issue 2626443003: Improve MediaPlayerBridge seek resiliance (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/android/media_player_renderer.h" 5 #include "content/browser/media/android/media_player_renderer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "content/browser/android/scoped_surface_request_manager.h" 10 #include "content/browser/android/scoped_surface_request_manager.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DVLOG(3) << __func__; 102 DVLOG(3) << __func__;
103 flush_cb.Run(); 103 flush_cb.Run();
104 } 104 }
105 105
106 void MediaPlayerRenderer::StartPlayingFrom(base::TimeDelta time) { 106 void MediaPlayerRenderer::StartPlayingFrom(base::TimeDelta time) {
107 // MediaPlayerBridge's Start() is idempotent, except when it has encountered 107 // MediaPlayerBridge's Start() is idempotent, except when it has encountered
108 // an error (in which case, calling Start() again is logged as a new error). 108 // an error (in which case, calling Start() again is logged as a new error).
109 if (has_error_) 109 if (has_error_)
110 return; 110 return;
111 111
112 media_player_->SeekTo(time);
112 media_player_->Start(); 113 media_player_->Start();
113 114
114 // Drop the seek if we are live streaming or if we don't have any duration
115 // information yet.
116 if (duration_ != media::kInfiniteDuration)
117 media_player_->SeekTo(time);
118
119 // WMPI needs to receive a BUFFERING_HAVE_ENOUGH data before sending a 115 // WMPI needs to receive a BUFFERING_HAVE_ENOUGH data before sending a
120 // playback_rate > 0. The MediaPlayer manages its own buffering and will pause 116 // playback_rate > 0. The MediaPlayer manages its own buffering and will pause
121 // internally if ever it runs out of data. Sending BUFFERING_HAVE_ENOUGH here 117 // internally if ever it runs out of data. Sending BUFFERING_HAVE_ENOUGH here
122 // is always safe. 118 // is always safe.
123 // 119 //
124 // NOTE: OnBufferingUpdate is triggered whenever the media has buffered or 120 // NOTE: OnBufferingUpdate is triggered whenever the media has buffered or
125 // played up to a % value between 1-100, and it's not a reliable indicator of 121 // played up to a % value between 1-100, and it's not a reliable indicator of
126 // the buffering state. 122 // the buffering state.
127 // 123 //
128 // TODO(tguilbert): Investigate the effect of this call on UMAs. 124 // TODO(tguilbert): Investigate the effect of this call on UMAs.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void MediaPlayerRenderer::CancelScopedSurfaceRequest() { 273 void MediaPlayerRenderer::CancelScopedSurfaceRequest() {
278 if (!surface_request_token_) 274 if (!surface_request_token_)
279 return; 275 return;
280 276
281 ScopedSurfaceRequestManager::GetInstance()->UnregisterScopedSurfaceRequest( 277 ScopedSurfaceRequestManager::GetInstance()->UnregisterScopedSurfaceRequest(
282 surface_request_token_); 278 surface_request_token_);
283 surface_request_token_ = base::UnguessableToken(); 279 surface_request_token_ = base::UnguessableToken();
284 } 280 }
285 281
286 } // namespace content 282 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_player_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698