[FFmpeg-devel] [PATCH]Do not limit blocksize when reading PCM from aiff

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Jun 2 13:54:38 CEST 2014


Hi!

Attached patch fixes ticket #3695 for me.
Decoding speed for ima_qt can be improved if no limit 
is used for block_size, ffmpeg prints a warning in that 
case: "Multiple frames in a packet from stream 0"
(Possibly similar for GSM.)

Please review, CArl Eu
-------------- next part --------------
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 81bcc64..7accec4 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -344,10 +344,16 @@ static int aiff_read_packet(AVFormatContext *s,
         return AVERROR_EOF;
 
     /* Now for that packet */
-    if (st->codec->block_align >= 17) // GSM, QCLP, IMA4
+    switch (st->codec->codec_id) {
+    case AV_CODEC_ID_ADPCM_IMA_QT:
+    case AV_CODEC_ID_GSM:
+    case AV_CODEC_ID_QDM2:
+    case AV_CODEC_ID_QCELP:
         size = st->codec->block_align;
-    else
+        break;
+    default:
         size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;
+    }
     size = FFMIN(max_size, size);
     res = av_get_packet(s->pb, pkt, size);
     if (res < 0)


More information about the ffmpeg-devel mailing list