[vlc-commits] sout: transcode: keep fmtin for audio after test (fix #21727)
Francois Cartegnie
git at videolan.org
Fri Feb 8 21:20:27 CET 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 8 21:18:18 2019 +0100| [a34939f5f61054659553ecdb1c1a13a9b70c6bc6] | committer: Francois Cartegnie
sout: transcode: keep fmtin for audio after test (fix #21727)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a34939f5f61054659553ecdb1c1a13a9b70c6bc6
---
modules/stream_out/transcode/audio.c | 2 +-
modules/stream_out/transcode/encoder/audio.c | 15 ++++++++++-----
modules/stream_out/transcode/encoder/encoder.h | 2 +-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 7c7ce6edbb..82578c9077 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -263,7 +263,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
if( !transcode_encoder_opened( id->encoder ) )
{
transcode_encoder_audio_configure( VLC_OBJECT(p_stream), id->p_enccfg,
- &id->decoder_out.audio, id->encoder );
+ &id->decoder_out.audio, id->encoder, true );
id->fmt_input_audio = id->decoder_out.audio;
}
else
diff --git a/modules/stream_out/transcode/encoder/audio.c b/modules/stream_out/transcode/encoder/audio.c
index 6b2f72c518..64f311e961 100644
--- a/modules/stream_out/transcode/encoder/audio.c
+++ b/modules/stream_out/transcode/encoder/audio.c
@@ -77,7 +77,7 @@ int transcode_encoder_audio_open( transcode_encoder_t *p_enc,
static int encoder_audio_configure( vlc_object_t *p_obj,
const transcode_encoder_config_t *p_cfg,
const audio_format_t *p_dec_out,
- encoder_t *p_enc )
+ encoder_t *p_enc, bool b_keep_fmtin )
{
VLC_UNUSED(p_obj);
audio_format_t *p_enc_in = &p_enc->fmt_in.audio;
@@ -107,9 +107,13 @@ static int encoder_audio_configure( vlc_object_t *p_obj,
if( p_enc_out->i_channels >= ARRAY_SIZE(pi_channels_maps) )
p_enc_out->i_channels = ARRAY_SIZE(pi_channels_maps) - 1;
- p_enc_in->i_physical_channels =
p_enc_out->i_physical_channels = pi_channels_maps[p_enc_out->i_channels];
+ if( b_keep_fmtin ) /* This is tested/wanted decoder fmtin */
+ return VLC_SUCCESS;
+
+ p_enc_in->i_physical_channels = p_enc_out->i_physical_channels;
+
/* Initialization of encoder format structures */
p_enc->fmt_in.i_codec = p_dec_out->i_format;
p_enc_in->i_format = p_dec_out->i_format;
@@ -132,9 +136,10 @@ static int encoder_audio_configure( vlc_object_t *p_obj,
int transcode_encoder_audio_configure( vlc_object_t *p_obj,
const transcode_encoder_config_t *p_cfg,
const audio_format_t *p_dec_out,
- transcode_encoder_t *p_enc )
+ transcode_encoder_t *p_enc,
+ bool b_keep_fmtin )
{
- return encoder_audio_configure( p_obj, p_cfg, p_dec_out, p_enc->p_encoder );
+ return encoder_audio_configure( p_obj, p_cfg, p_dec_out, p_enc->p_encoder, b_keep_fmtin );
}
int transcode_encoder_audio_test( vlc_object_t *p_obj,
@@ -155,7 +160,7 @@ int transcode_encoder_audio_test( vlc_object_t *p_obj,
audio_format_t *p_afmt_out = &p_encoder->fmt_out.audio;
- if( encoder_audio_configure( p_obj, p_cfg, &p_dec_out->audio, p_encoder ) )
+ if( encoder_audio_configure( p_obj, p_cfg, &p_dec_out->audio, p_encoder, false ) )
{
es_format_Clean( &p_encoder->fmt_in );
es_format_Clean( &p_encoder->fmt_out );
diff --git a/modules/stream_out/transcode/encoder/encoder.h b/modules/stream_out/transcode/encoder/encoder.h
index b6030aa31a..00827502e7 100644
--- a/modules/stream_out/transcode/encoder/encoder.h
+++ b/modules/stream_out/transcode/encoder/encoder.h
@@ -94,5 +94,5 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
int transcode_encoder_audio_configure( vlc_object_t *p_obj,
const transcode_encoder_config_t *p_cfg,
const audio_format_t *p_dec_out,
- transcode_encoder_t *p_enc );
+ transcode_encoder_t *p_enc, bool );
More information about the vlc-commits
mailing list