[FFmpeg-devel] [PATCH]lavf/mov: Do not blindly allocate stts entries

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Dec 30 15:36:39 EET 2017


2017-12-29 23:37 GMT+01:00 Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> 2017-11-28 21:32 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
>> On Mon, Nov 27, 2017 at 05:24:14AM +0100, Carl Eugen Hoyos wrote:
>
>>>      for (i = 0; i < entries && !pb->eof_reached; i++) {
>>> -        int sample_duration;
>>> +        int sample_duration, ret;
>>>          unsigned int sample_count;
>>> +        if (i > sc->stts_count) {
>>> +            ret = av_reallocp_array(&sc->stts_data,
>>> +                                    FFMIN(sc->stts_count * 2LL, entries),
>>> +                                    sizeof(*sc->stts_data));
>>
>> this should use a variant of av_fast_realloc
>
> Do you prefer the new patch?
> The old variant here looks slightly saner to me.

Attached is what you possibly had in mind.

Please review, Carl Eugen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavf-mov-Use-av_fast_realloc-in-mov_read_stts.patch
Type: text/x-patch
Size: 1620 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171230/aaa39ca3/attachment.bin>


More information about the ffmpeg-devel mailing list