diff options
| -rw-r--r-- | media/java/android/media/videoeditor/MediaArtistNativeHelper.java | 5 | ||||
| -rwxr-xr-x | media/jni/mediaeditor/VideoEditorMain.cpp | 14 |
2 files changed, 11 insertions, 8 deletions
diff --git a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java index 8c78d6044d4a..ad2bf954543e 100644 --- a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java +++ b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java @@ -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); diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp index 1ba5beb34843..23081f868fcb 100755 --- a/media/jni/mediaeditor/VideoEditorMain.cpp +++ b/media/jni/mediaeditor/VideoEditorMain.cpp @@ -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, |