summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AwesomePlayer.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-05 14:13:16 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-05 14:13:16 -0700
commita782d22f3eacd337c135feb12362934fc0adb6ca (patch)
tree73939ca570485beda8d81191f3f44637ce019bc6 /media/libstagefright/AwesomePlayer.cpp
parentb0ade8a64d3b3bee75b544313d2047efbb9604f7 (diff)
parentb2e3954c94717e43b3dc9b880564f166cfbbc0a2 (diff)
downloadframeworks_av-a782d22f3eacd337c135feb12362934fc0adb6ca.zip
frameworks_av-a782d22f3eacd337c135feb12362934fc0adb6ca.tar.gz
frameworks_av-a782d22f3eacd337c135feb12362934fc0adb6ca.tar.bz2
am 17bc4f65: Merge "Make sure to call AudioTrack::stop() instead of AudioTrack::pause() after submitting all samples to AudioTrack to make sure those remaining samples are actually played out." into gingerbread
Merge commit '17bc4f65324a823598e7671256c815bf32ddcc95' into gingerbread-plus-aosp * commit '17bc4f65324a823598e7671256c815bf32ddcc95': Make sure to call AudioTrack::stop() instead of AudioTrack::pause() after submitting all samples to AudioTrack to make sure those remaining samples are actually played out.
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 040e27d..bfc23d4 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -576,7 +576,7 @@ void AwesomePlayer::onStreamDone() {
notifyListener_l(
MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, mStreamDoneStatus);
- pause_l();
+ pause_l(true /* at eos */);
mFlags |= AT_EOS;
return;
@@ -600,7 +600,7 @@ void AwesomePlayer::onStreamDone() {
LOGV("MEDIA_PLAYBACK_COMPLETE");
notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
- pause_l();
+ pause_l(true /* at eos */);
mFlags |= AT_EOS;
}
@@ -738,7 +738,7 @@ status_t AwesomePlayer::pause() {
return pause_l();
}
-status_t AwesomePlayer::pause_l() {
+status_t AwesomePlayer::pause_l(bool at_eos) {
if (!(mFlags & PLAYING)) {
return OK;
}
@@ -746,7 +746,14 @@ status_t AwesomePlayer::pause_l() {
cancelPlayerEvents(true /* keepBufferingGoing */);
if (mAudioPlayer != NULL) {
- mAudioPlayer->pause();
+ if (at_eos) {
+ // If we played the audio stream to completion we
+ // want to make sure that all samples remaining in the audio
+ // track's queue are played out.
+ mAudioPlayer->pause(true /* playPendingSamples */);
+ } else {
+ mAudioPlayer->pause();
+ }
}
mFlags &= ~PLAYING;