OSDN Git Service

Fix issue 3369917 :Audio skips at clip edit points
authorDharmaray Kundargi <dharmaray@google.com>
Sun, 30 Jan 2011 02:52:50 +0000 (18:52 -0800)
committerDharmaray Kundargi <dharmaray@google.com>
Sun, 30 Jan 2011 02:52:50 +0000 (18:52 -0800)
Change-Id: Ibfdcf7511efe054cd41bc36690696c6eddd2e500

libvideoeditor/lvpp/DummyVideoSource.cpp
libvideoeditor/lvpp/PreviewPlayer.cpp
libvideoeditor/lvpp/VideoEditorPreviewController.cpp

index 4dbdc11..58487b2 100755 (executable)
@@ -42,7 +42,7 @@ namespace android {
 \r
 \r
 sp<DummyVideoSource> DummyVideoSource::Create (\r
-            uint32_t width, uint32_t height, \r
+            uint32_t width, uint32_t height,\r
             uint64_t clipDuration, const char *imageUri) {\r
     LOG2("DummyVideoSource::Create ");\r
     sp<DummyVideoSource> vSource = new DummyVideoSource (\r
@@ -52,7 +52,7 @@ sp<DummyVideoSource> DummyVideoSource::Create (
 \r
 \r
 DummyVideoSource::DummyVideoSource (\r
-            uint32_t width, uint32_t height, \r
+            uint32_t width, uint32_t height,\r
             uint64_t clipDuration, const char *imageUri) {\r
 \r
     LOG2("DummyVideoSource::DummyVideoSource constructor START");\r
@@ -119,8 +119,8 @@ sp<MetaData> DummyVideoSource::getFormat() {
     return meta;\r
 }\r
 \r
-status_t DummyVideoSource::read( \r
-                        MediaBuffer **out, \r
+status_t DummyVideoSource::read(\r
+                        MediaBuffer **out,\r
                         const MediaSource::ReadOptions *options) {\r
     status_t err = OK;\r
     MediaBuffer *buffer;\r
@@ -133,6 +133,7 @@ status_t DummyVideoSource::read(
     if (options && options->getSeekTo(&seekTimeUs, &seekMode)) {\r
         seeking = true;\r
         mImageSeekTime = seekTimeUs;\r
+        M4OSA_clockGetTime(&mImagePlayStartTime, 1000); //1000 time scale for time in ms\r
     }\r
 \r
     if ((mImageSeekTime == mImageClipDuration) || (mFrameTimeUs == mImageClipDuration)) {\r
index 242db5e..49f50cb 100644 (file)
@@ -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();
index 5128a41..744d410 100755 (executable)
@@ -1160,12 +1160,11 @@ void VideoEditorPreviewController::notify(
             break;\r
         case 0xAAAAAAAA:\r
             LOGV("VIDEO PLAYBACK ALMOST over, prepare next player");\r
-            pController->mPrepareReqest = M4OSA_TRUE;\r
             // Select next player and prepare it\r
             // If there is a clip after this one\r
             if ((pController->mCurrentClipNumber+1) <\r
              pController->mNumberClipsToPreview) {\r
-\r
+                pController->mPrepareReqest = M4OSA_TRUE;\r
                 pController->mCurrentPlayer++;\r
                 if (pController->mCurrentPlayer >= NBPLAYER_INSTANCES) {\r
                     pController->mCurrentPlayer = 0;\r