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

Unified Diff: media/base/android/media_player_listener.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: media/base/android/media_player_listener.cc
diff --git a/media/base/android/media_player_listener.cc b/media/base/android/media_player_listener.cc
index de1820190c7b8efe8d649e0ed0fd8f02d5a6f1e7..d64aac7b60761f69ac9e02006915a3f5e9122d11 100644
--- a/media/base/android/media_player_listener.cc
+++ b/media/base/android/media_player_listener.cc
@@ -35,9 +35,20 @@ void MediaPlayerListener::CreateMediaPlayerListener(
jobject context, jobject media_player) {
JNIEnv* env = AttachCurrentThread();
CHECK(env);
+ j_media_player_listener_.Reset(
+ Java_MediaPlayerListener_create(
+ env, reinterpret_cast<intptr_t>(this), context, media_player));
+}
+
- Java_MediaPlayerListener_create(
- env, reinterpret_cast<intptr_t>(this), context, media_player);
+void MediaPlayerListener::ReleaseMediaPlayerListenerResources() {
+ JNIEnv* env = AttachCurrentThread();
+ CHECK(env);
+ if (!j_media_player_listener_.is_null()) {
+ Java_MediaPlayerListener_releaseResources(
+ env, j_media_player_listener_.obj());
+ }
+ j_media_player_listener_.Reset();
}
void MediaPlayerListener::OnMediaError(
@@ -77,6 +88,12 @@ void MediaPlayerListener::OnMediaPrepared(
&MediaPlayerBridge::OnMediaPrepared, media_player_));
}
+void MediaPlayerListener::OnMediaInterrupted(
+ JNIEnv* /* env */, jobject /* obj */) {
+ message_loop_->PostTask(FROM_HERE, base::Bind(
+ &MediaPlayerBridge::OnMediaInterrupted, media_player_));
+}
+
bool MediaPlayerListener::RegisterMediaPlayerListener(JNIEnv* env) {
bool ret = RegisterNativesImpl(env);
DCHECK(g_MediaPlayerListener_clazz);
« no previous file with comments | « media/base/android/media_player_listener.h ('k') | webkit/media/android/webmediaplayer_in_process_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698