[FFmpeg-devel] Fix for seek issues with files >2GB

Baptiste Coudurier baptiste.coudurier
Tue Dec 1 23:57:18 CET 2009


On 12/01/2009 02:53 PM, Michael Niedermayer wrote:
> On Tue, Dec 01, 2009 at 02:21:43PM -0800, Sean Soria wrote:
>> In av_seek_frame_generic there are many calls to url_fseek that look like this:
>> if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET))<  0)
>>      return ret;
>>
>> Unfortunately, ret is declared as int, while url_fseek returns
>> int64_t, so the return value will be truncated before being compared
>> with zero.  Since url_fseek returns the current position on success,
>> certain values (2GB-4GB for instance) will be interpreted as negative
>> values despite being positive 64-bit values.  This patch declares ret
>> as an int64_t so that truncation does not occur until the value is
>> actually returned.
>>
>> --- libavformat/utils.c (revision 20690)
>> +++ libavformat/utils.c (working copy)
>> @@ -1513,7 +1513,8 @@ static int av_seek_frame_byte(AVFormatCo
>>   static int av_seek_frame_generic(AVFormatContext *s,
>>                                    int stream_index, int64_t timestamp,
>> int flags)
>>   {
>> -    int index, ret;
>> +    int index;
>> +    int64_t ret;
>>       AVStream *st;
>>       AVIndexEntry *ie;
>
> ok
>

Applied.

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



More information about the ffmpeg-devel mailing list