change windowBuffer to local reference

dev
xufuji456 3 years ago
parent 43ede7ab4b
commit 9ae3ee755f
  1. 6
      app/src/main/cpp/video_filter.c

@ -24,7 +24,6 @@ AVFilterGraph *filter_graph;
AVFormatContext *pFormatCtx; AVFormatContext *pFormatCtx;
AVCodecContext *pCodecCtx; AVCodecContext *pCodecCtx;
ANativeWindow_Buffer windowBuffer;
ANativeWindow *nativeWindow; ANativeWindow *nativeWindow;
int again; int again;
@ -339,6 +338,7 @@ VIDEO_PLAYER_FUNC(jint, filter, jstring filePath, jobject surface, jint position
ret = av_buffersink_get_frame(buffersink_ctx, filter_frame); ret = av_buffersink_get_frame(buffersink_ctx, filter_frame);
if (ret >= 0) { if (ret >= 0) {
// lock native window // lock native window
ANativeWindow_Buffer windowBuffer;
ANativeWindow_lock(nativeWindow, &windowBuffer, 0); ANativeWindow_lock(nativeWindow, &windowBuffer, 0);
// convert // convert
sws_scale(sws_ctx, (uint8_t const *const *) filter_frame->data, sws_scale(sws_ctx, (uint8_t const *const *) filter_frame->data,
@ -380,8 +380,8 @@ end:
av_free(filter_frame); av_free(filter_frame);
av_free(pFrame); av_free(pFrame);
// free(audio_track); audio_track = NULL;
// free(&windowBuffer); audio_track_write_mid = NULL;
ANativeWindow_release(nativeWindow); ANativeWindow_release(nativeWindow);
(*env)->ReleaseStringUTFChars(env, filePath, file_name); (*env)->ReleaseStringUTFChars(env, filePath, file_name);
LOGE(TAG, "do release..."); LOGE(TAG, "do release...");

Loading…
Cancel
Save