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

Commit d13f987f authored by Dheeraj Sharma's avatar Dheeraj Sharma Committed by Android Git Automerger
Browse files

am 36b685ff: Merge "Fix for issue : 3419353 Crash during transition generation" into honeycomb

* commit '36b685ff':
  Fix for issue :  3419353 Crash during transition generation
parents 859563eb 36b685ff
Loading
Loading
Loading
Loading
+33 −28
Original line number Diff line number Diff line
@@ -1566,6 +1566,7 @@ public class VideoEditorImpl implements VideoEditor {
        }

        boolean semAcquireDone = false;
        if (!mPreviewInProgress) {
            try{
                semAcquireDone = mMANativeHelper.lock(ENGINE_ACCESS_MAX_TIMEOUT_MS);
                if (semAcquireDone == false) {
@@ -1573,11 +1574,11 @@ public class VideoEditorImpl implements VideoEditor {
                }

                if (mMediaItems.size() > 0) {
                    mPreviewInProgress = true;
                    mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
                                                      mAudioTracks, null);
                    mMANativeHelper.doPreview(surface, fromMs, toMs, loop,
                                     callbackAfterFrameCount, listener);
                mPreviewInProgress = true;
                }
                /**
                 *  release on complete by calling stopPreview
@@ -1585,10 +1586,9 @@ public class VideoEditorImpl implements VideoEditor {
            } catch (InterruptedException ex) {
                Log.w(TAG, "The thread was interrupted", new Throwable());
                throw new IllegalStateException("The thread was interrupted");
        } finally {
            if (semAcquireDone) {
                mMANativeHelper.unlock();
            }
         } else {
            throw new IllegalStateException("Preview already in progress");
        }
    }

@@ -1596,15 +1596,20 @@ public class VideoEditorImpl implements VideoEditor {
     * {@inheritDoc}
     */
    public long stopPreview() {
        long result = 0;
        if (mPreviewInProgress) {
            long result = mMANativeHelper.stopPreview();
            mPreviewInProgress = false;
            try {
                result = mMANativeHelper.stopPreview();
                /**
             *  release the sem acquired in startPreview
                 *  release on complete by calling stopPreview
                 */
                } finally {
                    mPreviewInProgress = false;
                    mMANativeHelper.unlock();
                }
            return result;
        } else {
        }
        else {
            return 0;
        }
    }