Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8114b1c authored by Chih-Chung Chang's avatar Chih-Chung Chang Committed by Android Git Automerger
Browse files

am fbb122bf: Merge "Fix 5607624: Native crash in movie studio while previewing...

am fbb122bf: Merge "Fix 5607624: Native crash in movie studio while previewing the movie" into ics-mr1

* commit 'fbb122bfb2615f007a8b321d553669e8ff56c40b':
  Fix 5607624: Native crash in movie studio while previewing the movie
parents 29aaef16 482cedda
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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;
@@ -221,7 +227,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;
            }

+1 −0
Original line number Diff line number Diff line
@@ -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;