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

Unified Diff: content/browser/media/android/browser_media_player_manager.cc

Issue 81693003: Release media player resources when device is locked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 1 more typo Created 7 years, 1 month 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 | « content/browser/media/android/browser_media_player_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/android/browser_media_player_manager.cc
diff --git a/content/browser/media/android/browser_media_player_manager.cc b/content/browser/media/android/browser_media_player_manager.cc
index d37366ce7ee3d0978acc2b3d6569bae435f19b07..29b9d2d2438ad405239405a968de4b6490e792bb 100644
--- a/content/browser/media/android/browser_media_player_manager.cc
+++ b/content/browser/media/android/browser_media_player_manager.cc
@@ -92,6 +92,7 @@ BrowserMediaPlayerManager::BrowserMediaPlayerManager(
: WebContentsObserver(WebContents::FromRenderViewHost(render_view_host)),
fullscreen_player_id_(-1),
pending_fullscreen_player_id_(-1),
+ fullscreen_player_is_released_(false),
web_contents_(WebContents::FromRenderViewHost(render_view_host)),
weak_ptr_factory_(this) {
}
@@ -131,6 +132,10 @@ bool BrowserMediaPlayerManager::OnMessageReceived(const IPC::Message& msg) {
void BrowserMediaPlayerManager::FullscreenPlayerPlay() {
MediaPlayerAndroid* player = GetFullscreenPlayer();
if (player) {
+ if (fullscreen_player_is_released_) {
+ video_view_->OpenVideo();
+ fullscreen_player_is_released_ = false;
+ }
player->Start();
Send(new MediaPlayerMsg_DidMediaPlayerPlay(
routing_id(), fullscreen_player_id_));
@@ -149,6 +154,9 @@ void BrowserMediaPlayerManager::FullscreenPlayerPause() {
void BrowserMediaPlayerManager::FullscreenPlayerSeek(int msec) {
MediaPlayerAndroid* player = GetFullscreenPlayer();
if (player) {
+ // TODO(kbalazs): if |fullscreen_player_is_released_| is true
+ // at this point, player->GetCurrentTime() will be wrong until
+ // FullscreenPlayerPlay (http://crbug.com/322798).
OnSeekRequest(fullscreen_player_id_,
base::TimeDelta::FromMilliseconds(msec));
}
@@ -499,11 +507,10 @@ void BrowserMediaPlayerManager::OnSetVolume(int player_id, double volume) {
void BrowserMediaPlayerManager::OnReleaseResources(int player_id) {
MediaPlayerAndroid* player = GetPlayer(player_id);
- // Don't release the fullscreen player when tab visibility changes,
- // it will be released when user hit the back/home button or when
- // OnDestroyPlayer is called.
- if (player && player_id != fullscreen_player_id_)
+ if (player)
player->Release();
+ if (player_id == fullscreen_player_id_)
+ fullscreen_player_is_released_ = true;
#if defined(GOOGLE_TV)
WebContentsViewAndroid* view =
« no previous file with comments | « content/browser/media/android/browser_media_player_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698