Fix issue 3369917 :Audio skips at clip edit points
Change-Id: Ibfdcf7511efe054cd41bc36690696c6eddd2e500
diff --git a/libvideoeditor/lvpp/DummyVideoSource.cpp b/libvideoeditor/lvpp/DummyVideoSource.cpp
index 4dbdc11..58487b2 100755
--- a/libvideoeditor/lvpp/DummyVideoSource.cpp
+++ b/libvideoeditor/lvpp/DummyVideoSource.cpp
@@ -42,7 +42,7 @@
sp<DummyVideoSource> DummyVideoSource::Create (
- uint32_t width, uint32_t height,
+ uint32_t width, uint32_t height,
uint64_t clipDuration, const char *imageUri) {
LOG2("DummyVideoSource::Create ");
sp<DummyVideoSource> vSource = new DummyVideoSource (
@@ -52,7 +52,7 @@
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 @@
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 @@
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 242db5e..49f50cb 100644
--- a/libvideoeditor/lvpp/PreviewPlayer.cpp
+++ b/libvideoeditor/lvpp/PreviewPlayer.cpp
@@ -508,6 +508,15 @@
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 5128a41..744d410 100755
--- a/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
+++ b/libvideoeditor/lvpp/VideoEditorPreviewController.cpp
@@ -1160,12 +1160,11 @@
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;