[FFmpeg-devel] [PATCH] Fix segv in mpeg* decoders with -threads 0

Baptiste Coudurier baptiste.coudurier
Thu Apr 22 22:46:49 CEST 2010


On 04/21/2010 05:12 PM, Michael Niedermayer wrote:
> On Tue, Apr 20, 2010 at 04:29:55PM -0700, Baptiste Coudurier wrote:
>> Hi
>>
>> $subject.
>>
>> --
>> Baptiste COUDURIER
>> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
>> FFmpeg maintainer                                  http://www.ffmpeg.org
>
>>   mpegvideo.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 1313ff9d938f0c4e67e2fc7934c120c0d89e8c11  threads_0_segv.patch
>> Index: libavcodec/mpegvideo.c
>> ===================================================================
>> --- libavcodec/mpegvideo.c	(revision 22926)
>> +++ libavcodec/mpegvideo.c	(working copy)
>> @@ -655,7 +655,7 @@
>>       s->context_initialized = 1;
>>
>>       s->thread_context[0]= s;
>> -    threads = s->avctx->thread_count;
>> +    threads = FFMAX(1, s->avctx->thread_count);
>
> we should do something similar to mpegvideo_enc.c
> namely:
>      if(s->avctx->thread_count<  1){
>          av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n");
>          return -1;
>      }
>
> that said, even better would be to implement the automatic detection

Agree, however this function is called by frame so it will spoil stderr :/

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list