From 53c567c3355255ed12dd9f5d5a1c58f821770329 Mon Sep 17 00:00:00 2001 From: Dharmaray Kundargi Date: Sat, 29 Jan 2011 18:52:50 -0800 Subject: [PATCH] Fix issue 3369917 :Audio skips at clip edit points Change-Id: Ibfdcf7511efe054cd41bc36690696c6eddd2e500 --- libvideoeditor/lvpp/DummyVideoSource.cpp | 9 +++++---- libvideoeditor/lvpp/PreviewPlayer.cpp | 9 +++++++++ libvideoeditor/lvpp/VideoEditorPreviewController.cpp | 3 +-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libvideoeditor/lvpp/DummyVideoSource.cpp b/libvideoeditor/lvpp/DummyVideoSource.cpp index 4dbdc11399..58487b23c7 100755 --- a/libvideoeditor/lvpp/DummyVideoSource.cpp +++ b/libvideoeditor/lvpp/DummyVideoSource.cpp @@ -42,7 +42,7 @@ namespace android { sp DummyVideoSource::Create ( - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, uint64_t clipDuration, const char *imageUri) { LOG2("DummyVideoSource::Create "); sp vSource = new DummyVideoSource ( @@ -52,7 +52,7 @@ sp DummyVideoSource::Create ( DummyVideoSource::DummyVideoSource ( - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, uint64_t clipDuration, const char *imageUri) { LOG2("DummyVideoSource::DummyVideoSource constructor START"); @@ -119,8 +119,8 @@ sp DummyVideoSource::getFormat() { return meta; } -status_t DummyVideoSource::read( - MediaBuffer **out, +status_t DummyVideoSource::read( + MediaBuffer **out, const MediaSource::ReadOptions *options) { status_t err = OK; MediaBuffer *buffer; @@ -133,6 +133,7 @@ status_t DummyVideoSource::read( if (options && options->getSeekTo(&seekTimeUs, &seekMode)) { seeking = true; mImageSeekTime = seekTimeUs; + M4OSA_clockGetTime(&mImagePlayStartTime, 1000); //1000 time scale for time in ms } if ((mImageSeekTime == mImageClipDuration) || (mFrameTimeUs == mImageClipDuration)) { diff --git a/libvideoeditor/lvpp/PreviewPlayer.cpp b/libvideoeditor/lvpp/PreviewPlayer.cpp index 242db5e55e..49f50cb540 100644 --- a/libvideoeditor/lvpp/PreviewPlayer.cpp +++ b/libvideoeditor/lvpp/PreviewPlayer.cpp @@ -508,6 +508,15 @@ VideoEditorAudioPlayer *mVePlayer; mTimeSource = &mSystemTimeSource; } + // Set the seek option for Image source files and read. + // This resets the timestamping for image play + if (mIsVideoSourceJpg) { + MediaSource::ReadOptions options; + MediaBuffer *aLocalBuffer; + options.setSeekTo(mSeekTimeUs); + mVideoSource->read(&aLocalBuffer, &options); + } + if (mVideoSource != NULL) { // Kick off video playback postVideoEvent_l(); diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp index 5128a41691..744d41036f 100755 --- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp +++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp @@ -1160,12 +1160,11 @@ void VideoEditorPreviewController::notify( break; case 0xAAAAAAAA: LOGV("VIDEO PLAYBACK ALMOST over, prepare next player"); - pController->mPrepareReqest = M4OSA_TRUE; // Select next player and prepare it // If there is a clip after this one if ((pController->mCurrentClipNumber+1) < pController->mNumberClipsToPreview) { - + pController->mPrepareReqest = M4OSA_TRUE; pController->mCurrentPlayer++; if (pController->mCurrentPlayer >= NBPLAYER_INSTANCES) { pController->mCurrentPlayer = 0; -- 2.11.0