summaryrefslogtreecommitdiffstats
path: root/libvideoeditor
diff options
context:
space:
mode:
authorHong Teng <hongteng@google.com>2011-10-05 17:26:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-05 17:26:34 -0700
commit2534acb86e3f9ea94ed989f778f2606b79536fbc (patch)
treeadb3325b94c9d2ddc1a3204f59fd1c78499b543d /libvideoeditor
parent93d4a21f1c73df290e26a21e7a628f28d50bd035 (diff)
parente018023b4844fef7880bf5e45f706afcb10c33b6 (diff)
downloadframeworks_av-2534acb86e3f9ea94ed989f778f2606b79536fbc.zip
frameworks_av-2534acb86e3f9ea94ed989f778f2606b79536fbc.tar.gz
frameworks_av-2534acb86e3f9ea94ed989f778f2606b79536fbc.tar.bz2
Merge "Fix for 5369981 Native crash : testPreviewWithEndAudioTrack functional test."
Diffstat (limited to 'libvideoeditor')
-rwxr-xr-xlibvideoeditor/lvpp/PreviewPlayer.cpp22
-rwxr-xr-xlibvideoeditor/lvpp/PreviewPlayer.h1
2 files changed, 20 insertions, 3 deletions
diff --git a/libvideoeditor/lvpp/PreviewPlayer.cpp b/libvideoeditor/lvpp/PreviewPlayer.cpp
index b63d0d2..1330c7f 100755
--- a/libvideoeditor/lvpp/PreviewPlayer.cpp
+++ b/libvideoeditor/lvpp/PreviewPlayer.cpp
@@ -342,7 +342,7 @@ status_t PreviewPlayer::play() {
Mutex::Autolock autoLock(mLock);
mFlags &= ~CACHE_UNDERRUN;
-
+ mFlags &= ~INFORMED_AV_EOS;
return play_l();
}
@@ -481,8 +481,24 @@ void PreviewPlayer::onStreamDone() {
//This lock is used to syncronize onStreamDone() in PreviewPlayer and
//stopPreview() in PreviewController
Mutex::Autolock autoLock(mLockControl);
- notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
-
+ /* Make sure PreviewPlayer only notifies MEDIA_PLAYBACK_COMPLETE once for each clip!
+ * It happens twice in following scenario.
+ * To make the clips in preview storyboard are played and switched smoothly,
+ * PreviewController uses two PreviewPlayer instances and one AudioPlayer.
+ * The two PreviewPlayer use the same AudioPlayer to play the audio,
+ * and change the audio source of the AudioPlayer.
+ * If the audio source of current playing clip and next clip are dummy
+ * audio source(image or video without audio), it will not change the audio source
+ * to avoid the "audio glitch", and keep using the current audio source.
+ * When the video of current clip reached the EOS, PreviewPlayer will set EOS flag
+ * for video and audio, and it will notify MEDIA_PLAYBACK_COMPLETE.
+ * But the audio(dummy audio source) is still playing(for next clip),
+ * and when it reached the EOS, and video reached EOS,
+ * PreviewPlayer will notify MEDIA_PLAYBACK_COMPLETE again. */
+ if (!(mFlags & INFORMED_AV_EOS)) {
+ notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
+ mFlags |= INFORMED_AV_EOS;
+ }
mFlags |= AT_EOS;
LOGV("onStreamDone end");
return;
diff --git a/libvideoeditor/lvpp/PreviewPlayer.h b/libvideoeditor/lvpp/PreviewPlayer.h
index c6fb62b..16dcca2 100755
--- a/libvideoeditor/lvpp/PreviewPlayer.h
+++ b/libvideoeditor/lvpp/PreviewPlayer.h
@@ -95,6 +95,7 @@ private:
AUDIO_AT_EOS = 256,
VIDEO_AT_EOS = 512,
AUTO_LOOPING = 1024,
+ INFORMED_AV_EOS = 2048,
};
void cancelPlayerEvents(bool keepBufferingGoing = false);