[FFmpeg-devel] [PATCH] recover from truncated aiff

Maksym Veremeyenko verem
Wed Nov 26 08:14:33 CET 2008


Baptiste Coudurier ???????(??):
[...]
>> +    /* Now for that packet */
>> +    ret= av_get_packet(s->pb, pkt, (RAW_PACKET_SIZE / st->codec->block_align) * st->codec->block_align);
> 
> Michael suggested to use RAW_PACKET_SIZE*st->codec->block_align in case 
> it was not clear, this way packets have the same duration, whatever 
> channels or bps it is.
I will use this in further version of patches for aiff.c and raw.c

>> +    /* align packet on truncated file */
>> +    if (0 != (ret % st->codec->block_align)) {
>> +        pkt->size -= pkt->size % st->codec->block_align;
>> +        av_log(s, AV_LOG_WARNING, "truncated packet detected, dropped %d bytes\n", ret - pkt->size);
>> +    }
> 
> Humm, you do not set pkt->size before ?
No, i assumed ret should be equal pkt->size, but after i checked
*av_get_packet* implementation i am sure.

> Also use "if (ret % st->codec->block_align) {", more clear.
i will use this form.

> 
>>      pkt->dts=
>> -    pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
>> +    pkt->pts= pkt->pos / st->codec->block_align;
> 
> This is cosmetic and should be in a separate patch IMHO.
It not quite cosmetic, bps and block_align calculation moved to
*raw_read_header* like for other demuxers.

I will prepare newer/updated patches for aiff.c and raw.c

Any other suggestion for this?

-- 
________________________________________
Maksym Veremeyenko




More information about the ffmpeg-devel mailing list