avconv: Use the size of the decode sample format when allocating the audio samples...
authorAlex Converse <alex.converse@gmail.com>
Tue, 27 Sep 2011 17:20:23 +0000 (10:20 -0700)
committerAlex Converse <alex.converse@gmail.com>
Tue, 27 Sep 2011 21:10:12 +0000 (14:10 -0700)
avconv.c

index ed5d709..ad5547f 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -1573,8 +1573,8 @@ static int output_packet(InputStream *ist, int ist_index,
         if (ist->decoding_needed) {
             switch(ist->st->codec->codec_type) {
             case AVMEDIA_TYPE_AUDIO:{
-                if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
-                    samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
+                if(pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
+                    samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE);
                     av_free(samples);
                     samples= av_malloc(samples_size);
                 }