[FFmpeg-cvslog] r12780 - trunk/libavcodec/dca.c

banan subversion
Thu Apr 10 08:15:17 CEST 2008


Author: banan
Date: Thu Apr 10 08:15:17 2008
New Revision: 12780

Log:
Only set channels in the stream if previously unset, fixes resampling crash on broken dca frames

Modified:
   trunk/libavcodec/dca.c

Modified: trunk/libavcodec/dca.c
==============================================================================
--- trunk/libavcodec/dca.c	(original)
+++ trunk/libavcodec/dca.c	Thu Apr 10 08:15:17 2008
@@ -1173,7 +1173,14 @@ static int dca_decode_frame(AVCodecConte
         s->output = DCA_STEREO;
     }
 
-    avctx->channels = channels;
+    /* There is nothing that prevents a dts frame to change channel configuration
+       but FFmpeg doesn't support that so only set the channels if it is previously
+       unset. Ideally during the first probe for channels the crc should be checked
+       and only set avctx->channels when the crc is ok. Right now the decoder could
+       set the channels based on a broken first frame.*/
+    if (!avctx->channels)
+        avctx->channels = channels;
+
     if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
         return -1;
     *data_size = 0;




More information about the ffmpeg-cvslog mailing list