multiple decoders in separate threads
Hello, I am developing an application that is decoding and displaying multiple video's at the same time using ffmpeg. Each video is decoded and displayed in a separate thread. Things seem to go wrong when multiple threads are using the avc libs, even no data at all is shared between the threads; every thread has its own AVFormatContext, AVCodecContext, AVCodec, etc. by 'wrong' I mean that the decoding of the video stream is failing in different ways. Usually something like this is being logged : overreading 664 bits concealing 544 DC, 544 AC, 544 MV errors error, slice code was 16 header damaged and avcodec_decode_video returns a negative value but every now and then I even get double free()'s and glibc aborts : (gdb) bt #0 0xb7da6129 in free () from /lib/tls/libc.so.6 #1 0xb7da6d5e in free () from /lib/tls/libc.so.6 #2 0xb7da7bf7 in memalign () from /lib/tls/libc.so.6 #3 0x080bc5f8 in av_malloc (size=3083062840) at mem.c:62 #4 0x0806c0f1 in av_get_packet (s=0xb7e73920, pkt=0x85b1648, size=-1209589772) at utils.c:197 #5 0x080817ee in avi_read_packet (s=0x8412e50, pkt=0x8354da0) at avidec.c:427 #6 0x0805514d in ffmpeg_thread_main (thread_data=0x83d7690) at vsd-ffmpeg.c:86 #7 0xb7eedd4b in SDL_RunThread () from /usr/lib/libSDL-1.2.so.0 #8 0xb7eee0bd in SDL_KillThread () from /usr/lib/libSDL-1.2.so.0 #9 0xb7c1bcfd in start_thread () from /lib/tls/libpthread.so.0 #10 0xb7e1013e in clone () from /lib/tls/libc.so.6 or (gdb) bt #0 0xb7d3e7a7 in raise () from /lib/tls/libc.so.6 #1 0xb7d4004b in abort () from /lib/tls/libc.so.6 #2 0xb7d75005 in __fsetlocking () from /lib/tls/libc.so.6 #3 0xb7d7b657 in malloc_usable_size () from /lib/tls/libc.so.6 #4 0xb7d7baf2 in free () from /lib/tls/libc.so.6 #5 0x08069383 in av_destruct_packet (pkt=0xb7e47ff4) at utils.c:181 #6 0x080550fc in ffmpeg_thread_main (thread_data=0x83d7690) at avformat.h:71 I suspect there is are issues with running multiple ffmpeg instances in a threading environment. Is this supposed to work properly, and am I just missing something ? Linux 2.6.14 GNU C Library stable release version 2.3.5 ffmpeg cvs 2005/02/15 Please let me know if I need to provide any more details. Thank you very much, -- :wq ^X^Cy^K^X^C^C^C^C
* On 2006-02-16 ffmpeg at zevv.nl <ffmpeg at zevv.nl> wrote :
Things seem to go wrong when multiple threads are using the avc libs, even no data at all is shared between the threads; every thread has its own AVFormatContext, AVCodecContext, AVCodec, etc.
My apologies, I have already solved this issue, and it was my own fault, of course. (I lied about the threads not sharing any data, since AVPacket was declared staticly in the decoder function)
<ffmpeg <at> zevv.nl> writes:
I am developing an application that is decoding and displaying multiple video's at the same time using ffmpeg. Each video is decoded and displayed in a separate thread.
Things seem to go wrong when multiple threads are using the avc libs, even no data at all is shared between the threads; every thread has its own AVFormatContext, AVCodecContext, AVCodec, etc.
I suspect there is are issues with running multiple ffmpeg instances in a threading environment. Is this supposed to work properly, and am I just missing something ?
if I understand this right, you are starting different instances of ffmpeg? or did you modify the source of ffmpeg, enabling multiple threads? can you also please send your ./configure arguments? btw: in ffmpeg/ffmpeg.c "multiple threads" sometimes appear, but I never got it working
participants (2)
-
ffmpeg@zevv.nl -
fvquicke@gmail.com