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

Unified Diff: content/browser/android/media_player_manager_android.cc

Issue 11348199: Free (and pause) audio resources when getting a phone call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_color
Patch Set: Created 8 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
Index: content/browser/android/media_player_manager_android.cc
diff --git a/content/browser/android/media_player_manager_android.cc b/content/browser/android/media_player_manager_android.cc
index 2716079527d87d29b038f0b989d201ddebb68a88..98a51e2e572d760dfa7040241a58911f035e1f36 100644
--- a/content/browser/android/media_player_manager_android.cc
+++ b/content/browser/android/media_player_manager_android.cc
@@ -123,6 +123,8 @@ void MediaPlayerManagerAndroid::OnInitialize(
base::Bind(&MediaPlayerManagerAndroid::OnSeekComplete,
base::Unretained(this)),
base::Bind(&MediaPlayerManagerAndroid::OnTimeUpdate,
+ base::Unretained(this)),
+ base::Bind(&MediaPlayerManagerAndroid::OnMediaInterrupted,
base::Unretained(this))));
// Send a MediaPrepared message to webkit so that Load() can finish.
@@ -220,6 +222,12 @@ void MediaPlayerManagerAndroid::OnPlaybackComplete(int player_id) {
video_view_.OnPlaybackComplete();
}
+void MediaPlayerManagerAndroid::OnMediaInterrupted(int player_id) {
+ // Tell WebKit that the audio should be paused, then release all resources
+ Send(new MediaPlayerMsg_DidMediaPlayerPause(routing_id(), player_id));
+ OnReleaseResources(player_id);
+}
+
void MediaPlayerManagerAndroid::OnBufferingUpdate(
int player_id, int percentage) {
Send(new MediaPlayerMsg_MediaBufferingUpdate(
« no previous file with comments | « content/browser/android/media_player_manager_android.h ('k') | content/shell/android/java/AndroidManifest.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698