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

Unified Diff: media/base/android/media_player_bridge.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
« no previous file with comments | « media/base/android/media_player_bridge.h ('k') | media/base/android/media_player_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_player_bridge.cc
diff --git a/media/base/android/media_player_bridge.cc b/media/base/android/media_player_bridge.cc
index a0c6a0ec30f8a1e26bfe915724fc2e21b1de71c9..4ebde7dfbe42e12aeb1fe0d1f434d067d5642cc0 100644
--- a/media/base/android/media_player_bridge.cc
+++ b/media/base/android/media_player_bridge.cc
@@ -56,13 +56,15 @@ MediaPlayerBridge::MediaPlayerBridge(
const MediaPreparedCB& media_prepared_cb,
const PlaybackCompleteCB& playback_complete_cb,
const SeekCompleteCB& seek_complete_cb,
- const TimeUpdateCB& time_update_cb)
+ const TimeUpdateCB& time_update_cb,
+ const MediaInterruptedCB& media_interrupted_cb)
: media_error_cb_(media_error_cb),
video_size_changed_cb_(video_size_changed_cb),
buffering_update_cb_(buffering_update_cb),
media_prepared_cb_(media_prepared_cb),
playback_complete_cb_(playback_complete_cb),
seek_complete_cb_(seek_complete_cb),
+ media_interrupted_cb_(media_interrupted_cb),
time_update_cb_(time_update_cb),
player_id_(player_id),
prepared_(false),
@@ -245,6 +247,8 @@ void MediaPlayerBridge::Release() {
JNIEnv* env = AttachCurrentThread();
JNI_MediaPlayer::Java_MediaPlayer_release(env, j_media_player_.obj());
j_media_player_.Reset();
+
+ listener_.ReleaseMediaPlayerListenerResources();
}
void MediaPlayerBridge::SetVolume(float left_volume, float right_volume) {
@@ -281,6 +285,12 @@ void MediaPlayerBridge::OnPlaybackComplete() {
playback_complete_cb_.Run(player_id_);
}
+
+void MediaPlayerBridge::OnMediaInterrupted() {
+ time_update_timer_.Stop();
+ media_interrupted_cb_.Run(player_id_);
+}
+
void MediaPlayerBridge::OnSeekComplete() {
seek_complete_cb_.Run(player_id_, GetCurrentTime());
}
« no previous file with comments | « media/base/android/media_player_bridge.h ('k') | media/base/android/media_player_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698