pesintta / vdr-plugin-vaapidevice

VDR VAAPIDevice Plug-in
9 stars 11 forks source link

looks like this crashes now in branch ffdemux #118

Open 9000h opened 6 years ago

9000h commented 6 years ago

https://github.com/pesintta/vdr-plugin-vaapidevice/blob/b1f79f797bec0b21c2afab3cceb8c96db5e955dd/codec.c#L440

Thread 39 "device 1 receiv" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffa6bd2700 (LWP 3039)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff614ee97 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff6150801 in __GI_abort () at abort.c:79
#2  0x00007fffed2500dd in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#3  0x00007fffed768044 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#4  0x00007fffed76968e in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#5  0x00007fffed3c58d0 in avcodec_flush_buffers ()
    at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#6  0x00007fffeee05aa2 in CodecVideoFlushBuffers (decoder=0x555555c5ba70)
    at codec.c:440
#7  0x00005555556b6705 in cPlayer::DeviceClear() (this=0x555556185948)
    at player.h:31
#8  0x00005555556b6705 in cTransfer::Receive(unsigned char const*, int) (this=0x5555561857f0, Data=0x7fffdc49ed33 "G\023\355\021\304\313\365\341\374+\215\245W\216\271\001\016\236\327\213\227I\373\325P\235\305+\034\211t\252$\223+13\001\036\027S?9\272jqS\336\037\315\030|FGa\302\037G%\017\352ko\301\236\t\272E\334=\\\361\346ř\314\362\235\027\340\371x\375y\370\071\226\267\254\017\263\277\037c\327_|\312\350y\372\017\206e\351\bd\342\177\020n\031\302Q\032\233K\274\306\347\336\353:\n\035z\241\370H\206h\v#\346\377_Pڸi'Fj)\274\022.b\221\310T\344\065\016\030\016J\275\336Oc]* \001\311~\\/^9*;\031\237\021\370\247՟*\177A^\367*=\357G", Length=188) at transfer.c:56
#9  0x000055555560a302 in cDevice::Action() (this=0x5555560dab50)
    at device.c:1681
---Type <return> to continue, or q <return> to quit---
#10 0x00005555556a7e35 in cThread::StartThread(cThread*) (Thread=0x5555560dab50) at thread.c:293
#11 0x00007ffff79556db in start_thread (arg=0x7fffa6bd2700)
    at pthread_create.c:463
#12 0x00007ffff623188f in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
pesintta commented 6 years ago

Thank you for reporting.

This might be caused by threads. Can you try to disable them with the following patch and then try to reproduce the crash:

diff --git a/codec.c b/codec.c
index bcf3d31..d36c12a 100644
--- a/codec.c
+++ b/codec.c
@@ -277,10 +277,6 @@ void CodecVideoOpen(VideoDecoder * decoder)
     // FIXME: for software decoder use all cpus, otherwise 1
     decoder->VideoCtx->thread_count = 1;
     // open codec
-    if (video_codec->capabilities & (AV_CODEC_CAP_AUTO_THREADS)) {
-       Debug4("codec: auto threads enabled");
-       decoder->VideoCtx->thread_count = 0;
-    }

     decoder->VideoCtx->opaque = decoder;    // our structure

@@ -293,16 +289,6 @@ void CodecVideoOpen(VideoDecoder * decoder)
     if (video_codec->capabilities & AV_CODEC_CAP_DR1) {
        Debug4("codec: can use own buffer management");
     }
-    if (video_codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) {
-       Debug4("codec: supports frame threads");
-       decoder->VideoCtx->thread_count = 0;
-       decoder->VideoCtx->thread_type |= FF_THREAD_FRAME;
-    }
-    if (video_codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
-       Debug4("codec: supports slice threads");
-       decoder->VideoCtx->thread_count = 0;
-       decoder->VideoCtx->thread_type |= FF_THREAD_SLICE;
-    }
     decoder->VideoCtx->thread_safe_callbacks = 0;
     decoder->VideoCtx->get_format = Codec_get_format;
     decoder->VideoCtx->get_buffer2 = Codec_get_buffer2;

Also note that the ffdemux branch is under heavy development and not yet stable. I'm hoping it may eventually help with the audio issues reported in https://github.com/pesintta/vdr-plugin-vaapidevice/issues/98

9000h commented 6 years ago

I know it's not stable with the patch it works and I cannot reproduce the crash(before when running in gdb it did crash immediately)

9000h commented 6 years ago

there is another crash on startup sometimes (witch the patch)

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `vdr -D- -l3 -w 60 -Pfemon -Psatip  -d2 -s 192.168.178.129:554|DVBS2-4,DVBT2-2|m'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3137a8b700 (LWP 7106))]
(gdb) bt
#0  0x00007f31a6a1de97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f31a6a1f801 in __GI_abort () at abort.c:79
#2  0x00007f319de51ec8 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#3  0x00007f319de52065 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#4  0x00007f319de53518 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#5  0x00007f319de5ff64 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#6  0x00007f319dc917a7 in  () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#7  0x00007f319dc94588 in avcodec_send_packet () at /usr/lib/x86_64-linux-gnu/libavcodec.so.58
#8  0x00007f319f6d48b1 in CodecVideoDecode (decoder=0x560c04d0c000) at codec.c:397
#9  0x00007f319f6c132d in VideoDecodeInput (stream=0x7f319f8e3600 <MyVideoStream>) at vaapidev.c:623
#10 0x00007f319f6c6dba in VaapiDisplayHandlerThread () at video.c:3925
#11 0x00007f319f6cdc6c in VideoDisplayHandlerThread (dummy=<optimized out>) at video.c:4551
#12 0x00007f31a82246db in start_thread (arg=0x7f3137a8b700) at pthread_create.c:463
#13 0x00007f31a6b0088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
pesintta commented 6 years ago

I've not seen such before on my systems. Unfortunately the backtrace hides the actual source of the assert. You'll need to add debugging symbols to your ffmpeg to make the lines 2-6 of your backtrace to contain relevant information.

9000h commented 6 years ago

here it goes

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `vdr -D- -l3 -w 60 -Pfemon -Psatip  -d2 -s 192.168.178.129:554|DVBS2-4,DVBT2-2|m'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3137a8b700 (LWP 7106))]
(gdb) bt
#0  0x00007f31a6a1de97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f31a6a1f801 in __GI_abort () at abort.c:79
#2  0x00007f319de51ec8 in alloc_frame (s=s@entry=0x7f312c077180) at src/libavcodec/hevc_refs.c:117
#3  0x00007f319de52065 in generate_missing_ref (poc=-80, s=0x7f312c077180) at src/libavcodec/hevc_refs.c:402
#4  0x00007f319de52065 in add_candidate_ref (s=s@entry=0x7f312c077180, list=0x7f312c0776c8, poc=-80, ref_flag=ref_flag@entry=2) at src/libavcodec/hevc_refs.c:441
#5  0x00007f319de53518 in ff_hevc_frame_rps (s=s@entry=0x7f312c077180) at src/libavcodec/hevc_refs.c:491
#6  0x00007f319de5ff64 in hevc_frame_start (s=0x7f312c077180) at src/libavcodec/hevcdec.c:2789
#7  0x00007f319de5ff64 in decode_nal_unit (nal=<optimized out>, s=0x7f312c077180) at src/libavcodec/hevcdec.c:2934
#8  0x00007f319de5ff64 in decode_nal_units (length=<optimized out>, buf=<optimized out>, s=0x7f312c077180) at src/libavcodec/hevcdec.c:3045
#9  0x00007f319de5ff64 in hevc_decode_frame (avctx=<optimized out>, data=<optimized out>, got_output=<optimized out>, avpkt=<optimized out>) at src/libavcodec/hevcdec.c:3181
#10 0x00007f319dc917a7 in decode_simple_internal (frame=0x7f312c3407c0, avctx=0x7f312c33fd80) at src/libavcodec/decode.c:398
#11 0x00007f319dc917a7 in decode_simple_receive_frame (frame=<optimized out>, avctx=<optimized out>) at src/libavcodec/decode.c:594
#12 0x00007f319dc917a7 in decode_receive_frame_internal (avctx=avctx@entry=0x7f312c33fd80, frame=0x7f312c3407c0) at src/libavcodec/decode.c:612
#13 0x00007f319dc94588 in avcodec_send_packet (avctx=avctx@entry=0x7f312c33fd80, avpkt=0x7f3137a8acf0) at src/libavcodec/decode.c:674
#14 0x00007f319f6d48b1 in CodecVideoDecode (decoder=0x560c04d0c000) at codec.c:397
#15 0x00007f319f6c132d in VideoDecodeInput (stream=0x7f319f8e3600 <MyVideoStream>) at vaapidev.c:623
#16 0x00007f319f6c6dba in VaapiDisplayHandlerThread () at video.c:3925
#17 0x00007f319f6cdc6c in VideoDisplayHandlerThread (dummy=<optimized out>) at video.c:4551
#18 0x00007f31a82246db in start_thread (arg=0x7f3137a8b700) at pthread_create.c:463
#19 0x00007f31a6b0088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)