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

Commit 28926cb9 authored by Santosh Madhava's avatar Santosh Madhava Committed by Android (Google) Code Review
Browse files

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

parents e355e75a df4723ef
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);
+9 −5
Original line number Diff line number Diff line
@@ -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,