[FFmpeg-devel] [PATCH 2/2] avcodec/mediacodec_surface: define and use FFANativeWindow to mimic NDK interface

Matthieu Bouron matthieu.bouron at gmail.com
Fri Sep 6 12:55:31 EEST 2019


On Thu, Sep 05, 2019 at 04:07:20PM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman at tmm1.net>
> 
> This will make it easy to switch to ANativeWindow_fromSurface
> and ANativeWindow_release in the future.
> 
> Signed-off-by: Aman Gupta <aman at tmm1.net>
> ---
>  libavcodec/mediacodec_surface.c | 11 ++++-------
>  libavcodec/mediacodec_surface.h |  7 +++++--
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/mediacodec_surface.c b/libavcodec/mediacodec_surface.c
> index efcc4dc63c..a292386e34 100644
> --- a/libavcodec/mediacodec_surface.c
> +++ b/libavcodec/mediacodec_surface.c
> @@ -25,10 +25,9 @@
>  #include "ffjni.h"
>  #include "mediacodec_surface.h"
>  
> -void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
> +FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
>  {
>      JNIEnv *env = NULL;
> -    void *reference = NULL;
>  
>      if (!surface)
>          return NULL;
> @@ -38,12 +37,10 @@ void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
>          return NULL;
>      }
>  
> -    reference = (*env)->NewGlobalRef(env, surface);
> -
> -    return reference;
> +    return (*env)->NewGlobalRef(env, surface);

This should be done in a separate commit.

[...]

-- 
Matthieu B.


More information about the ffmpeg-devel mailing list