Permalink
Browse files

Fix audio distortion at end of output (3576437 and kdenlive-2834).

  • Loading branch information...
1 parent cd38ed4 commit ac184f555a939e2653463d51ed4258983cbf9c84 @ddennedy ddennedy committed Nov 21, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/modules/avformat/consumer_avformat.c
@@ -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
}

0 comments on commit ac184f5

Please sign in to comment.