diff options
author | Chih-Chung Chang <chihchung@google.com> | 2011-11-15 18:35:24 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-15 18:35:24 -0800 |
commit | fbb122bfb2615f007a8b321d553669e8ff56c40b (patch) | |
tree | 7f5730a69ecb574bcd3b2bd0dcd8ac4a7b6155e3 | |
parent | 811c53c58a870397f2864003dc21d5799a422b26 (diff) | |
parent | 0d2c710a293d68fb729eff148d40002f5deacf17 (diff) | |
download | libvideoeditor-fbb122bfb2615f007a8b321d553669e8ff56c40b.tar.gz |
Merge "Fix 5607624: Native crash in movie studio while previewing the movie" into ics-mr1
-rwxr-xr-x | lvpp/VideoEditorSRC.cpp | 11 | ||||
-rwxr-xr-x | lvpp/VideoEditorSRC.h | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lvpp/VideoEditorSRC.cpp b/lvpp/VideoEditorSRC.cpp index 1ea32ef..364343a 100755 --- a/lvpp/VideoEditorSRC.cpp +++ b/lvpp/VideoEditorSRC.cpp @@ -41,6 +41,7 @@ VideoEditorSRC::VideoEditorSRC(const sp<MediaSource> &source) { mBuffer = NULL; mLeftover = 0; mFormatChanged = false; + mStopPending = false; mSeekMode = ReadOptions::SEEK_PREVIOUS_SYNC; // Input Source validation @@ -127,6 +128,11 @@ status_t VideoEditorSRC::read( // Resample to target quality mResampler->resample(pTmpBuffer, outFrameCnt, this); + if (mStopPending) { + stop(); + mStopPending = false; + } + // Change resampler and retry if format change happened if (mFormatChanged) { mFormatChanged = false; @@ -220,7 +226,10 @@ status_t VideoEditorSRC::getNextBuffer(AudioBufferProvider::Buffer *pBuffer) { // EOS or some other error if (err != OK) { LOGV("EOS or some err: %d", err); - stop(); + // We cannot call stop() here because stop() will release the + // AudioResampler, and we are in a callback of the AudioResampler. + // So just remember the fact and let read() call stop(). + mStopPending = true; return err; } diff --git a/lvpp/VideoEditorSRC.h b/lvpp/VideoEditorSRC.h index a5e8e22..c61b7c1 100755 --- a/lvpp/VideoEditorSRC.h +++ b/lvpp/VideoEditorSRC.h @@ -78,6 +78,7 @@ class VideoEditorSRC : public MediaSource , public AudioBufferProvider { MediaBuffer* mBuffer; int32_t mLeftover; bool mFormatChanged; + bool mStopPending; int64_t mInitialTimeStampUs; int64_t mAccuOutBufferSize; |