[FFmpeg-soc] [soc] Fix ff_frame_thread_flush()

Alexander Strange astrange at ithinksw.com
Tue Jun 24 09:45:44 CEST 2008


On Jun 24, 2008, at 3:18 AM, Benoit Fouet wrote:

> Alexander Strange wrote:
>> diff --git a/libavcodec/framethread.c b/libavcodec/framethread.c
>> index 7be5189..a0f80c8 100644
>> --- a/libavcodec/framethread.c
>> +++ b/libavcodec/framethread.c
>> @@ -334,10 +337,16 @@ void ff_frame_thread_flush(AVCodecContext  
>> *avctx)
>>             ff_release_buffer(&p->released_buffers[j]);
>>
>>         p->nb_released_buffers = 0;
>> +
>> +        memset(&p->result, 0, sizeof(AVFrame));
>>
>
> why is that needed ?

After seeking in my mpeg1 sample, the decoder would return the right  
stuff and set sizeof(AVFrame) in data_size (mpeg12.c:2343), but  
wouldn't actually write to the frame. That means that I had a released  
AVFrame there, and when it called ff_report_decode_progress on I got  
memory corruption. Clearing that was the easiest workaround I saw.

It looks like I should call avcodec_get_frame_defaults before each  
decode instead, which does the same thing.



More information about the FFmpeg-soc mailing list