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
>>>>
>>>> [...]
>>>>
>>>>       
>>   
> 
> 


-- 
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: [EMAIL PROTECTED]
Skype: uzadow
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to