From: ddennedy Date: Tue, 25 Nov 2008 21:02:20 +0000 (+0000) Subject: producer_avformat.c: bugfix r1242 segfault due to improper audio decoder memory alloc... X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=0133c5c9a0020292ff56b3c68cf4be67b4c5d474;p=melted producer_avformat.c: bugfix r1242 segfault due to improper audio decoder memory allocation. Also fix logical bug with resampling on channels > 2 git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1244 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 1dfb5a9..ce24483 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -999,7 +999,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form int paused = 0; // Check for resample and create if necessary - if ( resample == NULL && ( *frequency != codec_context->sample_rate || codec_context->channels <= 2 ) ) + if ( resample == NULL && codec_context->channels <= 2 ) { // Create the resampler resample = audio_resample_init( *channels, codec_context->channels, *frequency, codec_context->sample_rate ); @@ -1038,10 +1038,10 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form if ( decode_buffer == NULL ) { // Allocate the audio buffer - decode_buffer = mlt_pool_alloc( AVCODEC_MAX_AUDIO_FRAME_SIZE * sizeof( int16_t ) ); + decode_buffer = av_malloc( AVCODEC_MAX_AUDIO_FRAME_SIZE * sizeof( int16_t ) ); // And store it on properties for reuse - mlt_properties_set_data( properties, "decode_buffer", decode_buffer, 0, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_properties_set_data( properties, "decode_buffer", decode_buffer, 0, ( mlt_destructor )av_free, NULL ); } #if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))