[mythtv] mediacodec errors

Aman Gupta aman at tmm1.net
Sun Aug 5 18:38:14 UTC 2018


Hi Peter,

I've been working on trying to reproduce this issue. It looks like it never
happens when using Surface based zero-copy rendering.

When copying frame data, I can reproduce after flushing rapidly. Looking at
logcat, I see that the entire mediacodec decoder appears to be crashing:

A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint:
'NVIDIA/foster_e/foster:8.0.0/OPR6.170623.010/3019194_1174.8512:user/release-keys'
    Revision: '0'
    ABI: 'arm'
    pid: 431, tid: 27041, name: media.codec  >>> android.hardwar <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
    Cause: null pointer dereference
A/DEBUG:     r0 4a22f810  r1 00000010  r2 00000220  r3 00000030
        r4 4a203240  r5 4e7ed000  r6 4e7ee18c  r7 4a22f800
        r8 00000000  r9 00000002  sl 00030d40  fp 5246a91c
        ip 80000000  sp 5246a868  lr 4cf455d1  pc 4936be9c  cpsr a00f0010
A/DEBUG: backtrace:
        #00 pc 00018e9c  /system/lib/libc.so (memcpy+124)
        #01 pc 0000b5cd  /vendor/lib/libnvmmlite_video.so
        #02 pc 0000aaab  /vendor/lib/libnvmmlite_video.so
        #03 pc 0000636c  /vendor/lib/libnvos.so
        #04 pc 0004831f  /system/lib/libc.so (_ZL15__pthread_startPv+22)
        #05 pc 0001b4df  /system/lib/libc.so (__start_thread+32)
E//system/bin/tombstoned: Tombstone written to:
/data/tombstones//tombstone_03
E/ACodec: OMX/mediaserver died, signalling error!
    signalError(omxError 0x8000100d, internalError -32)
I/ServiceManager: service 'media.codec' died
E/MediaCodec: Codec reported err 0xffffffe0, actionCode 0, while in state 7
E/NdkMediaCodec: sf error code: -32
E/ffmpeg: [ffmpeg/video] h264_mediacodec: Failed to flush codec

Are you seeing anything like this in the logs?

Aman

On Mon, Jul 2, 2018 at 1:06 PM Peter Bennett <pb.mythtv at gmail.com> wrote:

> Hi Aman
>
> This workaround that I sent you (see below) is not successful. On
> Android 8 I am getting illegal state exceptions with FF with 720p
> recordings, with the workaround in place.
>
> Peter
>
>
> On 06/29/2018 05:40 PM, Peter Bennett wrote:
> > The method dequeueOutputBuffer can throw IllegalStateException.
> > According to the MediaCodec documentation that means it is not in the
> > Executing state, or codec is configured in asynchronous mode. I don't
> > have enough understanding of how it works to know why that would be.
> >
> > I believe that this may only happen with 1080i interlaced video.
> >
> > The situation only occurs if you send several packets until there are
> > frames available, then receive only one frame from the codec context
> > and then flush, expecting to lose any remaining frames. Doing this
> > sequence repeatedly causes the error after about 10 or 15 times.
> > Somehow those available frames are not being correctly flushed. By
> > adding my own code to discard those frames I avoid the problem.
> >
> > Add this code before avcodec_flush_buffers:
> >
> >                 int ret = 0;
> >                 while (ret == 0)
> >                 {
> >                     AVFrame *frame = av_frame_alloc();
> >                     ret = avcodec_receive_frame(enc, frame);
> >                     av_frame_free(&frame);
> >                 }
> >
> > No More exceptions!!
> >
> > It should not be necessary to receive all available frames and discard
> > them like this before flushing. Perhaps something like this code
> > snippet should be added to avcodec_flush_buffers.
> >
> > Please let me know if you make any change in ffmpeg to solve this
> > issue so that I can remove this piece of code.
> >
> > Peter
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20180805/c8eba5dd/attachment.html>


More information about the mythtv-dev mailing list