[vlc-devel] [PATCH] transcode: Reset audio filters chain if samplerate and/or number of channels change
Ludovic Fauvet
etix at videolan.org
Thu Jun 7 17:21:58 CEST 2012
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.
> + 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.
> + }
> +
> + 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,
-- Ludovic Fauvet
More information about the vlc-devel
mailing list