[vlc-devel] [PATCH] transcode: Reset audio filters chain if samplerate and/or number of channels change
Aurélien Nephtali
aurelien.nephtali at gmail.com
Thu Jun 7 18:04:29 CEST 2012
On Thu, Jun 7, 2012 at 5:21 PM, Ludovic Fauvet <etix at videolan.org> wrote:
> On Thu, Jun 7, 2012 at 4:56 PM, Aurélien Nephtali
> <aurelien.nephtali at gmail.com> wrote:
>> From 2f977fba3eb03eca1cedff5b13e3f86f824a395e Mon Sep 17 00:00:00 2001
>> From: Aurelien Nephtali <aurelien.nephtali at gmail.com>
>> Date: Thu, 7 Jun 2012 16:51:03 +0200
>> Subject: [PATCH 2/2] transcode: Reset audio filters chain if samplerate
>> and/or number of channels change
>>
>> ---
>> modules/stream_out/transcode/audio.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
>> index a041e06..2653d92 100644
>> --- a/modules/stream_out/transcode/audio.c
>> +++ b/modules/stream_out/transcode/audio.c
>> @@ -326,6 +326,28 @@ int transcode_audio_process( sout_stream_t *p_stream,
>> while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder,
>> &in )) )
>> {
>> + if ( id->p_decoder->fmt_in.audio.i_rate != id->p_decoder->fmt_out.audio.i_rate ||
>> + id->p_decoder->fmt_in.audio.i_channels != id->p_decoder->fmt_out.audio.i_channels )
>> + {
>> + msg_Warn( p_stream, "decoder changed stream specs (samplerate: %i -> %i, channels: %i -> %i)",
>
> Mixing tabs and spaces.
Fixed.
>
>> + id->p_decoder->fmt_in.audio.i_rate, id->p_decoder->fmt_out.audio.i_rate,
>> + id->p_decoder->fmt_in.audio.i_channels, id->p_decoder->fmt_out.audio.i_channels );
>> + id->p_decoder->fmt_in.audio.i_rate = id->p_decoder->fmt_out.audio.i_rate;
>> + id->p_decoder->fmt_in.audio.i_channels = id->p_decoder->fmt_out.audio.i_channels;
>> +
>> + filter_chain_Reset( id->p_f_chain, &id->p_decoder->fmt_out, &id->p_encoder->fmt_in );
>> +
>> + if( transcode_audio_filter_chain_build( p_stream, id->p_f_chain,
>> + &id->p_encoder->fmt_in, &id->p_decoder->fmt_out ) )
>> + {
>> + transcode_audio_close( id );
>> + return VLC_EGENERIC;
>
> You're probably leaking p_audio_buf.
Fixed.
>
>> + }
>> +
>> + block_Release( p_audio_buf );
>> + continue;
>> + }
>> +
>> if( p_sys->b_master_sync )
>> {
>> mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
>> --
>> 1.7.10
>>
>
> Best regards,
I also removed the block_Release()/continue.
--
Aurélien Nephtali
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-transcode-Reset-audio-filters-chain-if-samplerate-an.patch
Type: application/octet-stream
Size: 2078 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120607/4dc33b6e/attachment.obj>
More information about the vlc-devel
mailing list