[mythtv] Seg Fault in mediacodec

Peter Bennett pb.mythtv at gmail.com
Mon Jul 2 19:57:59 UTC 2018


Hi Aman

Thank you for all your help so far.

I upgraded my Shield to Android 8.0. Now I get a seg fault every time I 
play 1080 interlaced recordings. Progressive recordings are fine, and 
480 interlaced are fine. Also 4K recordings are fine. With 1080 
interlaced it gets a seg fault in avcodec_receive_frame. This happens at 
about the fifth frame received in the video. It starts off fine, with 
avcodec_receive_frame returning EAGAIN until some number of packets have 
been sent, then it receives a few frames, then there is a seg fault in 
memcpy. There are no null addresses being passed to memcpy, but 
something must be invalid. This was working fine with Android 7. I am 
using the default buffer allocation: AVCodecContext->get_buffer2 = 
get_avf_buffer. avcodec_receive_frame should allocate the buffers using 
that routine so they should be valid.

Thread 42 "Thread-6" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 21798.21939]
0x0000002ade99c51c in memcpy () from 
/home/peter/proj/github.com/MythTV/packaging/android/so/libc.so
(gdb) bt
#0  0x0000002ade99c51c in memcpy () from 
/home/peter/proj/github.com/MythTV/packaging/android/so/libc.so
#1  0x0000002afc1afa4c in 
ff_mediacodec_sw_buffer_copy_yuv420_semi_planar 
(avctx=avctx at entry=0x2b13274c00,
     s=s at entry=0x2b14044cc0, data=data at entry=0x2b2ccc3a00 '\020' 
<repeats 200 times>..., size=size at entry=3110400,
     info=info at entry=0x2b19ed8bf8, frame=frame at entry=0x2b140ba800) at 
libavcodec/mediacodec_sw_buffer.c:159
#2  0x0000002afc1b418c in mediacodec_wrap_sw_buffer (frame=0x2b140ba800, 
info=0x2b19ed8bf8, index=7, size=3110400,
     data=0x2b2ccc3a00 '\020' <repeats 200 times>..., s=0x2b14044cc0, 
avctx=0x2b13274c00)
     at libavcodec/mediacodecdec_common.c:328
#3  ff_mediacodec_dec_receive (avctx=avctx at entry=0x2b13274c00, 
s=0x2b14044cc0, frame=frame at entry=0x2b140ba800,
     wait=wait at entry=true) at libavcodec/mediacodecdec_common.c:706
#4  0x0000002afc1b31e0 in mediacodec_receive_frame (avctx=0x2b13274c00, 
frame=0x2b140ba800)
     at libavcodec/mediacodecdec.c:432
#5  0x0000002afbf494e4 in decode_receive_frame_internal 
(avctx=avctx at entry=0x2b13274c00,
     frame=frame at entry=0x2b140ba800) at libavcodec/decode.c:610
#6  0x0000002afbf4bf28 in avcodec_receive_frame (avctx=0x2b13274c00, 
frame=0x2b140ba800) at libavcodec/decode.c:726
#7  0x0000002b0185bcdc in AvFormatDecoder::ProcessVideoPacket 
(this=0x2b0a41dc00, curstream=0x2b11bf6c80,
     pkt=0x2b13f45a20) at avformatdecoder.cpp:3653

Another backtrace shows some suspicious looking stuff in one of the 
buffers. a lot of 9's, 8's, 7's. I don't know if this gives a clue.

#0  0x0000002ade99c51c in memcpy () from 
/home/peter/proj/github.com/MythTV/packaging/android/so/libc.so
#1  0x0000002afc4b2a4c in 
ff_mediacodec_sw_buffer_copy_yuv420_semi_planar 
(avctx=avctx at entry=0x2b1293ee00,
     s=s at entry=0x2b1afa0aa0,
     data=data at entry=0x2b249f1a00 '9' <repeats 13 times>, ":::", '9' 
<repeats 13 times>, ":::", '9' <repeats 80 times>, 
":::999999999888899999889999889998998888889988889:998888999988887888888889988887789988888"..., 
size=size at entry=3110400,
     info=info at entry=0x2b17e42bf8, frame=frame at entry=0x2b04ba9c00) at 
libavcodec/mediacodec_sw_buffer.c:159
#2  0x0000002afc4b718c in mediacodec_wrap_sw_buffer (frame=0x2b04ba9c00, 
info=0x2b17e42bf8, index=7, size=3110400,
     data=0x2b249f1a00 '9' <repeats 13 times>, ":::", '9' <repeats 13 
times>, ":::", '9' <repeats 80 times>, 
":::999999999888899999889999889998998888889988889:998888999988887888888889988887789988888"..., 
s=0x2b1afa0aa0, avctx=0x2b1293ee00)
     at libavcodec/mediacodecdec_common.c:328
#3  ff_mediacodec_dec_receive (avctx=avctx at entry=0x2b1293ee00, 
s=0x2b1afa0aa0, frame=frame at entry=0x2b04ba9c00,
     wait=wait at entry=false) at libavcodec/mediacodecdec_common.c:706
#4  0x0000002afc4b6074 in mediacodec_receive_frame (avctx=0x2b1293ee00, 
frame=0x2b04ba9c00)
     at libavcodec/mediacodecdec.c:421
#5  0x0000002afc24c4e4 in decode_receive_frame_internal 
(avctx=avctx at entry=0x2b1293ee00,
     frame=frame at entry=0x2b04ba9c00) at libavcodec/decode.c:610
#6  0x0000002afc24ef28 in avcodec_receive_frame (avctx=0x2b1293ee00, 
frame=0x2b04ba9c00) at libavcodec/decode.c:726
#7  0x0000002b01857cdc in AvFormatDecoder::ProcessVideoPacket 
(this=0x2adf725800, curstream=0x2af790b300,
     pkt=0x2b03547440) at avformatdecoder.cpp:3653

Peter



More information about the mythtv-dev mailing list