Hi,

When decoding H.264 video data in FF_THREAD_FRAME mode there is an
infinite loop in ff_decode_frame_threaded after the first few frames in
the following line: while(p->state != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex); I call
avcodec_decode_video and pass one frame each time, resulting in the
behavior explained. When using only one thread everything is fine -
decoding works perfectly. The first frame I put into
avcodec_decode_video is an IDR frame if this is imporant. For debugging
purposes I also added three ALIVE messages which you can find in the
output below. They are located in frame_worker_thread in pthread.c,
ALIVE 0 before the while loop, ALIVE 1 before the call of codec->decode,
and ALIVE 2 after the latter, respectively.
When using only one thread everything works fine and the frames get
decoded (despite the error messages I get). What's the cause of this
infinite loop and how can I resolve this? The data I put in is ok as I
can decode it with ffmpeg (the application) as well as with other
decoders without any problems.

Regards,
Andreas


gdb output when using FF_THREAD_FRAME and two threads:

[New Thread 0xa46cbbb0 (LWP 20836)]
[h264 @ 0x8ab6e00]ALIVE 0 from 2758589360
[New Thread 0xa3e9ebb0 (LWP 20837)]
[h264 @ 0x8ab7190]ALIVE 0 from 2750016432
[h264 @ 0x8ab6e00]ALIVE 1 from 2758589360
[h264 @ 0x8ab7190]mmco: unref short failure
[h264 @ 0x8ab7190]ALIVE 1 from 2750016432
[h264 @ 0x8ab6e00]reference picture missing during reorder
[h264 @ 0x8ab6e00]Missing reference picture
[h264 @ 0x8ab6e00]ALIVE 2 from 2758589360
[h264 @ 0x8ab6e00]mmco: unref short failure
[h264 @ 0x8ab6e00]ALIVE 1 from 2758589360
[h264 @ 0x8ab7190]ALIVE 2 from 2750016432
[h264 @ 0x8ab7190]ALIVE 1 from 2750016432
[h264 @ 0x8ab6e00]ALIVE 2 from 2758589360
[h264 @ 0x8ab6e00]ALIVE 1 from 2758589360
[h264 @ 0x8ab6e00]reference picture missing during reorder
[h264 @ 0x8ab6e00]Missing reference picture
[h264 @ 0x8ab7190]ALIVE 2 from 2750016432
[h264 @ 0x8ab7190]mmco: unref short failure
[h264 @ 0x8ab7190]illegal short term buffer state detected
[h264 @ 0x8ab7190]ALIVE 1 from 2750016432


gdb bt for the affected thread:

#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7ee7cb6 in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/libpthread.so.0
#2  0x08178d1c in ff_decode_frame_threaded ()


gdb bt for the the two decoding threads:

Thread 22 (Thread 0xa3e1abb0 (LWP 20893)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7ee7cb6 in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/libpthread.so.0
#2  0x081775ac in ff_await_field_progress ()
#3  0x08af55f0 in ?? ()
#4  0x08af5668 in ?? ()
#5  0x00000004 in ?? ()
#6  0xa3e1dc4c in ?? ()
#7  0xa3e1dc2c in ?? ()
#8  0xa3e1dc48 in ?? ()
#9  0x08be1bd0 in ?? ()
#10 0x00000000 in ?? ()

Thread 21 (Thread 0xa4647bb0 (LWP 20892)):
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7ee7cb6 in pthread_cond_wait@@GLIBC_2.3.2 () from
/lib/libpthread.so.0
#2  0x081775ac in ff_await_field_progress ()
#3  0x08af55f0 in ?? ()
#4  0x08af5668 in ?? ()
#5  0x00000004 in ?? ()
#6  0x00000004 in ?? ()
#7  0x00000000 in ?? ()


Gdb output when using one thread:

[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[h264 @ 0x85c2530]illegal short term buffer state detected
[New Thread 0x991bdbb0 (LWP 21275)]
[New Thread 0x97c7abb0 (LWP 21276)]
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[Thread 0x9a84bbb0 (LWP 21274) exited]
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[Thread 0x991bdbb0 (LWP 21275) exited]
[h264 @ 0x85c2530]illegal short term buffer state detected
[New Thread 0xa15a6bb0 (LWP 21277)]
[Thread 0x97c7abb0 (LWP 21276) exited]
[Thread 0xa15a6bb0 (LWP 21277) exited]
[New Thread 0x9fde5bb0 (LWP 21278)]
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[h264 @ 0x85c2530]illegal short term buffer state detected
[New Thread 0x9e8f3bb0 (LWP 21279)]
[Thread 0x9fde5bb0 (LWP 21278) exited]
[New Thread 0x9d2d1bb0 (LWP 21280)]
[Thread 0x9e8f3bb0 (LWP 21279) exited]
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
[h264 @ 0x85c2530]reference picture missing during reorder
[h264 @ 0x85c2530]Missing reference picture
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to