[FFmpeg-devel] [PATCH] id3v2 unsynchronisation support

Alexander Kojevnikov alexander
Tue Aug 10 13:45:53 CEST 2010


On 10 August 2010 23:26, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Aug 09, 2010 at 10:03:09PM +1000, Alexander Kojevnikov wrote:
>> @@ -212,8 +216,26 @@ void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
>>
>> ? ? ? ? ?next = url_ftell(s->pb) + tlen;
>>
>> - ? ? ? ?if (tag[0] == 'T')
>> - ? ? ? ? ? ?read_ttag(s, tlen, tag);
>> + ? ? ? ?if (tag[0] == 'T') {
>> + ? ? ? ? ? ?if (unsync || tunsync) {
>> + ? ? ? ? ? ? ? ?int i, j;
>> + ? ? ? ? ? ? ? ?if (buffer_size < tlen) {
>> + ? ? ? ? ? ? ? ? ? ?buffer = av_realloc(buffer, tlen);
>> + ? ? ? ? ? ? ? ? ? ?buffer_size = tlen;
>> + ? ? ? ? ? ? ? ?}
>
> why the if() ?

You mean the last `if`? Because we don't know how realloc is
implemented on each platform, it can potentially be slow, even if the
new size is less than the new one. I think it makes sense to reduce
the number of library calls anyway, and it's not hard in this
particular case.

I don't insist though as I don't know much about *alloc implementation
details. Let me know if you want the patch changed to realloc the
buffer for each tag.

Thanks!



More information about the ffmpeg-devel mailing list