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

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Dec 30 00:37:47 EET 2017


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.

Carl Eugen


More information about the ffmpeg-devel mailing list