Merge "Fix for issue 3439595 : Java/JNI - Movide studio playback picks previous frames"

This commit is contained in:
Santosh Madhava
2011-02-17 19:10:02 -08:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 8 deletions

View File

@@ -3065,8 +3065,7 @@ class MediaArtistNativeHelper {
* This function is responsible for stopping the preview
*/
long stopPreview() {
nativeStopPreview();
return mPreviewProgress;
return nativeStopPreview();
}
/**
@@ -3999,7 +3998,7 @@ class MediaArtistNativeHelper {
int framewidth, int frameheight, int surfacewidth, int surfaceheight, long timeMs)
throws IllegalArgumentException, IllegalStateException, RuntimeException;
private native void nativeStopPreview();
private native int nativeStopPreview();
private native int nativeGenerateAudioGraph(String pcmFilePath, String outGraphPath,
int frameDuration, int channels, int sampleCount);

View File

@@ -208,7 +208,7 @@ videoEditor_populateSettings(
jobject object,
jobject audioSettingObject);
static void videoEditor_stopPreview(JNIEnv* pEnv,
static int videoEditor_stopPreview(JNIEnv* pEnv,
jobject thiz);
static jobject
@@ -283,8 +283,8 @@ static JNINativeMethod gManualEditMethods[] = {
{"nativeRenderMediaItemPreviewFrame",
"(Landroid/view/Surface;Ljava/lang/String;IIIIJ)I",
(int *)videoEditor_renderMediaItemPreviewFrame },
{"nativeStopPreview", "()V",
(void *)videoEditor_stopPreview },
{"nativeStopPreview", "()I",
(int *)videoEditor_stopPreview },
{"stopEncoding", "()V",
(void *)videoEditor_stopEncoding },
{"release", "()V",
@@ -482,11 +482,13 @@ static void jniPreviewProgressCallback (void* cookie, M4OSA_UInt32 msgType,
pContext->pVM->DetachCurrentThread();
}
static void videoEditor_stopPreview(JNIEnv* pEnv,
static int videoEditor_stopPreview(JNIEnv* pEnv,
jobject thiz)
{
ManualEditContext* pContext = M4OSA_NULL;
bool needToBeLoaded = true;
M4OSA_UInt32 lastProgressTimeMs = 0;
// Get the context.
pContext =
(ManualEditContext*)videoEditClasses_getContext(&needToBeLoaded, pEnv, thiz);
@@ -495,12 +497,14 @@ static void videoEditor_stopPreview(JNIEnv* pEnv,
videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
(M4OSA_NULL == pContext),
"not initialized");
pContext->mPreviewController->stopPreview();
lastProgressTimeMs = pContext->mPreviewController->stopPreview();
if (pContext->mOverlayFileName != NULL) {
M4OSA_free((M4OSA_MemAddr32)pContext->mOverlayFileName);
pContext->mOverlayFileName = NULL;
}
return lastProgressTimeMs;
}
static void videoEditor_clearSurface(JNIEnv* pEnv,