]> git.sesse.net Git - mlt/commitdiff
Fix audio distortion at end of output (3576437 and kdenlive-2834).
authorDan Dennedy <dan@dennedy.org>
Wed, 21 Nov 2012 00:15:00 +0000 (16:15 -0800)
committerDan Dennedy <dan@dennedy.org>
Wed, 21 Nov 2012 00:15:00 +0000 (16:15 -0800)
src/modules/avformat/consumer_avformat.c

index 37f4ef96b119c0f7ffddf0c35eac8b2c1ea07f2d..cd8e8d0291b0416eae09decc2ff8085dcad8fb9f 100644 (file)
@@ -535,9 +535,11 @@ static int pick_sample_fmt( mlt_properties properties, AVCodec *codec )
 static uint8_t* interleaved_to_planar( int samples, int channels, uint8_t* audio, int bytes_per_sample )
 {
        int size = samples * channels * bytes_per_sample;
-       uint8_t *buffer = mlt_pool_alloc( size );
+       uint8_t *buffer = mlt_pool_alloc( AUDIO_ENCODE_BUFFER_SIZE );
        uint8_t *p = buffer;
        int c;
+
+       memset( buffer, 0, AUDIO_ENCODE_BUFFER_SIZE );
        for ( c = 0; c < channels; c++ )
        {
                uint8_t *q = audio + c * bytes_per_sample;
@@ -1636,8 +1638,8 @@ static void *consumer_thread( void *arg )
 
 #if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
                                                        if ( codec->sample_fmt == AV_SAMPLE_FMT_FLTP
-                                                            || codec->sample_fmt == AV_SAMPLE_FMT_S16P
-                                                            || codec->sample_fmt == AV_SAMPLE_FMT_S32P )
+                                                                || codec->sample_fmt == AV_SAMPLE_FMT_S16P
+                                                                || codec->sample_fmt == AV_SAMPLE_FMT_S32P )
                                                                mlt_pool_release( p );
 #endif
                                                }