[FFmpeg-devel] [PATCH 2/2] lavc: add h264 mediacodec decoder

wm4 nfxjfg at googlemail.com
Tue Feb 23 11:28:01 CET 2016


On Tue, 23 Feb 2016 09:53:43 +0100
Matthieu Bouron <matthieu.bouron at gmail.com> wrote:

> On Mon, Feb 22, 2016 at 01:08:49PM +0100, Michael Niedermayer wrote:
> > On Mon, Feb 22, 2016 at 12:20:36PM +0100, Matthieu Bouron wrote:  
> > > From: Matthieu Bouron <matthieu.bouron at stupeflix.com>  
> > [...]  
> > > +        codec = (*env)->NewObject(env, jfields.mediacodec_list_class, jfields.init_id, 0);
> > > +        if (!codec) {
> > > +            av_log(NULL, AV_LOG_ERROR, "Could not create media codec list\n");
> > > +            goto done;
> > > +        }
> > > +
> > > +        tmp = (*env)->CallObjectMethod(env, codec, jfields.find_decoder_for_format_id, format);
> > > +        if (!tmp) {
> > > +            av_log(NULL, AV_LOG_ERROR, "Could not find decoder in media codec list\n");
> > > +            goto done;
> > > +        }
> > > +
> > > +        name = ff_jni_jstring_to_utf_chars(env, tmp, NULL);
> > > +        if (!name) {  
> >   
> > > +            av_log(NULL, AV_LOG_ERROR, "Could not convert jstring to utf chars\n");  
> > 
> > some non NULL context would be better, if possible, so the user knows
> > where an error came from  
> 
> It would require to pass the log_ctx (avctx) as an argument of
> ff_AMediaCodecList_getCodecByName.
> 
> All the functions of this wrapper does not take a log_ctx as argument
> to be as close as possible to the original NDK MediaCodec API. The
> NDK MediaCodec API does not provide any wrapper around MediaCodecList.
> 
> I would like the whole wrapper API to be consistent but also as close as
> possible to original one.
> If you think it's mandatory I can add a log_ctx argument to every
> functions of the wrapper API (so it will be used directly by av_log and
> ff_jni_exception_check).
> 
> On another note, I fixed locally this part of the code by adding missing calls
> to ff_jni_exception_check.
> 
> [...]

Is it possible to store the log_ctx somewhere in the JNI?

We might at some point in the future forbid av_log(NULL, ...) calls, and
then it'd get complicated.


More information about the ffmpeg-devel mailing list