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

Maksym Veremeyenko verem
Wed Nov 26 12:50:55 CET 2008


Michael Niedermayer ???????(??):
> On Wed, Nov 26, 2008 at 01:21:59PM +0200, Maksym Veremeyenko wrote:
[...]
>> According to that statement, all patches for wav, aiff and raw have no 
>> sense? Am i correct?
> 
> iam not aiff maintainer, but i yes raw and wav look wrong
May be it will be good to fix reading buffer size to value dividable by 
st->codec->block_align, like:
[...]
-    ret= av_get_packet(s->pb, pkt, size);
+    ret= av_get_packet(s->pb, pkt, RAW_PACKET_SIZE * 
st->codec->block_align);
[...]

>> What method is preferable to fixing issue with truncated file contains 
>> broken sample? Fixing pcm.c?
> 
> yes

Is that way:

Index: libavcodec/pcm.c
===================================================================
--- libavcodec/pcm.c    (revision 15899)
+++ libavcodec/pcm.c    (working copy)
@@ -358,9 +358,9 @@

      n = avctx->channels * sample_size;

-    if(n && buf_size % n){
-        av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
-        return -1;
+    if(n > 1 && buf_size % n){
+        buf_size -= buf_size % n;
+        av_log(avctx, AV_LOG_WARNING, "invalid PCM packet\n");
      }

      buf_size= FFMIN(buf_size, *data_size/2);

is correct?

-- 
________________________________________
Maksym Veremeyenko




More information about the ffmpeg-devel mailing list