Hey, Well I wasn't sure if I can use av_dup_packet() safely because in the header it is said that "@warning This is a hack - the packet memory allocation stuff is broken...". I will give it a try later.
Cheers, ALex Ulrich von Zadow wrote: > Hi, > > I think that's a misunderstanding. Frame fetching can be done in a > separate demuxer thread. The demuxer thread duplicates the packets using > av_dup_packet() and puts them in a queue for the decoder to use. > > Additionally, you can have separate decode and display threads, > connected by a queue of frames. You just have to make sure that the > frames that you put into the queue are not the original AVFrames that > you get from the decoder, because the decoder overwrites them. > > Cheers, > > Uli > > Alexander Benz wrote: > >> Hi, >> >> So basically, it's best to avoid doing frame fetching and decoding in >> parallel. >> But thanks for the insight ! :-) >> >> - ALex >> >> Michael Conrad wrote: >> >>> On Mon, 28 Jul 2008 08:40:56 -0400, MtTracer <[EMAIL PROTECTED]> wrote: >>> >>> >>>> Alexander Benz schrieb: >>>> >>>> >>>>> Hi there, >>>>> >>>>> I'm trying to setup a partly multi threaded video pipeline but my result >>>>> images come out distorted from time to time. >>>>> It seems like some lines of the video contain lines from the previous >>>>> frames ... but I can't find the exact cause. Maybe >>>>> anyone has experienced a similar effect or knows the answer to this >>>>> problem. >>>>> >>>>> In general, what I do is the following : >>>>> >>>>> Open the Mpeg2 video stream (av_open_input_file, avcodec_find_decoder, >>>>> avcodec_open etc.) then >>>>> >>>>> 1. Read a frame from the stream (av_read_frame) >>>>> >>>>> >>>>> >>>> Do you call av_dup_packet for the read packets in this step? Packets may >>>> become invalid >>>> after the next call to av_read_frame if you don't duplicate their data. >>>> >>>> >>> Actually its worse than this. The AVFrame must also be duplicated, >>> because some codecs re-use the pixel buffers. Basically you can only rely >>> on having a single AVFrame decoded at a time. This is only an issue for >>> some codecs, though. >>> >>> >>> >>>>> 2. Decode frame (avcodec_decode_video) >>>>> 3. Do color conversion (YUV --> RGB) >>>>> 4. Display Image >>>>> >>>>> [...] >>>>> >>>>> >>>>> >>> >>> >> > > > -- ------------------------------------------------------- Alexander Benz ask - Innovative Visualisierungslösungen GmbH Postfach 100 210 D-64202 Darmstadt tel: ++49 (0) 6159 71713 57 fax: +49 6159/7171390 web: www.askvisual.de E-Mail: [EMAIL PROTECTED] Registergericht: Amtsgericht Darmstadt, HRB 6177 Sitz: Messel Geschäftsführer: Hermin Aftahi und Dr. Florian Schröder ------------------------------------------------------- _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
