diff options
author | Hong Teng <hongteng@google.com> | 2011-09-28 18:40:38 -0700 |
---|---|---|
committer | Hong Teng <hongteng@google.com> | 2011-10-05 11:06:16 -0700 |
commit | e018023b4844fef7880bf5e45f706afcb10c33b6 (patch) | |
tree | 2246eff8d52a8d7333e86b06eee5b3016d94805c /libvideoeditor/lvpp/PreviewPlayer.cpp | |
parent | e62c387164f176b2f2484fe3bd84d8dc115b5d6b (diff) | |
download | frameworks_av-e018023b4844fef7880bf5e45f706afcb10c33b6.zip frameworks_av-e018023b4844fef7880bf5e45f706afcb10c33b6.tar.gz frameworks_av-e018023b4844fef7880bf5e45f706afcb10c33b6.tar.bz2 |
Fix for 5369981 Native crash : testPreviewWithEndAudioTrack functional test.
Change-Id: Icb8cadaff50a22588417c2c8f5c31415dd0cca9e
Diffstat (limited to 'libvideoeditor/lvpp/PreviewPlayer.cpp')
-rwxr-xr-x | libvideoeditor/lvpp/PreviewPlayer.cpp | 22 |
1 files changed, 19 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; |