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

Baptiste Coudurier baptiste.coudurier
Tue Nov 25 01:18:16 CET 2008


Hi,

Maksym Veremeyenko wrote:
> Hi!
> 
> During transcoding aiff files that is been truncated for 4 or 2 bytes i 
> get a message from pcm encoder:
> [pcm_s24be @ 0x93b4c70]invalid PCM packet
> Error while decoding stream #0.0
> 
> This output happens on last audio packet because it size is not 
> divisible by sample size.
> 
> This situation could be handled by two ways:
> 
> patch *aiff_handle_broken_sample.patch* fix packet size and notify about 
> that.
> 
> patch *aiff_save_broken_sample.patch* fix packet size and seek back to 
> position where broken sample start.
> 
> Any of fixes are correct?
> If not, how such situation should be handled?
> 

In general, avoiding seek is better in case of non streamable input, 
also if av_get_packet returns < requested, it means that it reached eof, 
so there is no need to seek back since the last sample will not be 
decoded anyway.

It seems this issue is also present in raw.c and wav.c

See thread:
"[FFmpeg-devel] [patch] 6 channel raw audio input results in invalid	PCM 
packet error", for a related problem, Im not saying that your patch is 
wrong though.

No need to check for eof, just ensure pkt->size is a block_align multiple.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
checking for life_signs in -lkenny... no




More information about the ffmpeg-devel mailing list