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); |