Merge "Fix for issue : 3419353 Crash during transition generation" into honeycomb
This commit is contained in:
committed by
Android (Google) Code Review
commit
36b685ffb0
@@ -1566,29 +1566,29 @@ public class VideoEditorImpl implements VideoEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean semAcquireDone = false;
|
boolean semAcquireDone = false;
|
||||||
try{
|
if (!mPreviewInProgress) {
|
||||||
semAcquireDone = mMANativeHelper.lock(ENGINE_ACCESS_MAX_TIMEOUT_MS);
|
try{
|
||||||
if (semAcquireDone == false) {
|
semAcquireDone = mMANativeHelper.lock(ENGINE_ACCESS_MAX_TIMEOUT_MS);
|
||||||
throw new IllegalStateException("Timeout waiting for semaphore");
|
if (semAcquireDone == false) {
|
||||||
}
|
throw new IllegalStateException("Timeout waiting for semaphore");
|
||||||
|
}
|
||||||
|
|
||||||
if (mMediaItems.size() > 0) {
|
if (mMediaItems.size() > 0) {
|
||||||
mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
|
mPreviewInProgress = true;
|
||||||
mAudioTracks, null);
|
mMANativeHelper.previewStoryBoard(mMediaItems, mTransitions,
|
||||||
mMANativeHelper.doPreview(surface, fromMs, toMs, loop,
|
mAudioTracks, null);
|
||||||
callbackAfterFrameCount, listener);
|
mMANativeHelper.doPreview(surface, fromMs, toMs, loop,
|
||||||
mPreviewInProgress = true;
|
callbackAfterFrameCount, listener);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* release on complete by calling stopPreview
|
* release on complete by calling stopPreview
|
||||||
*/
|
*/
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Log.w(TAG, "The thread was interrupted", new Throwable());
|
Log.w(TAG, "The thread was interrupted", new Throwable());
|
||||||
throw new IllegalStateException("The thread was interrupted");
|
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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public long stopPreview() {
|
public long stopPreview() {
|
||||||
|
long result = 0;
|
||||||
if (mPreviewInProgress) {
|
if (mPreviewInProgress) {
|
||||||
long result = mMANativeHelper.stopPreview();
|
try {
|
||||||
mPreviewInProgress = false;
|
result = mMANativeHelper.stopPreview();
|
||||||
/**
|
/**
|
||||||
* release the sem acquired in startPreview
|
* release on complete by calling stopPreview
|
||||||
*/
|
*/
|
||||||
mMANativeHelper.unlock();
|
} finally {
|
||||||
|
mPreviewInProgress = false;
|
||||||
|
mMANativeHelper.unlock();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user