From c08f85a6484ee5da7062a5eac0f19912bd7e2513 Mon Sep 17 00:00:00 2001 From: Dharmaray Kundargi Date: Tue, 1 Feb 2011 19:24:00 -0800 Subject: [PATCH] Fix issue 3414805 Crash during Overlay editing. JNI fixes. Change-Id: I5e966c6987920318d3ce03f78552d0028ef55a26 --- media/jni/mediaeditor/VideoEditorMain.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp index 221bfa1e93f05..101619c419d11 100755 --- a/media/jni/mediaeditor/VideoEditorMain.cpp +++ b/media/jni/mediaeditor/VideoEditorMain.cpp @@ -1485,7 +1485,7 @@ videoEditor_populateSettings( if ( pContext->pEditSettings->nbEffects ) { pOverlayIndex - = (int*) M4OSA_malloc(pContext->pEditSettings->nbEffects, 0, + = (int*) M4OSA_malloc(pContext->pEditSettings->nbEffects * sizeof(int), 0, (M4OSA_Char*)"pOverlayIndex"); } @@ -1528,9 +1528,15 @@ videoEditor_populateSettings( result = M4xVSS_internalConvertARGB888toYUV420_FrammingEffect(pContext->engineContext, &(pContext->pEditSettings->Effects[j]),aFramingCtx, pContext->pEditSettings->Effects[j].xVSS.framingScaledSize); - if (result != M4NO_ERROR) - { + videoEditJava_checkAndThrowRuntimeException(&needToBeLoaded, pEnv, + (M4NO_ERROR != result), result); + if (needToBeLoaded == false) { M4OSA_TRACE1_1("M4xVSS_internalConvertARGB888toYUV420_FrammingEffect returned 0x%x", result); + if (aFramingCtx != M4OSA_NULL) { + M4OSA_free((M4OSA_MemAddr32)aFramingCtx); + aFramingCtx = M4OSA_NULL; + } + return; } //framing buffers are resized to fit the output video resolution.