Commit 6894306c authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

transcode/audio: init muxer format lately

This can fix channels (or other params) mismatch when decoders update their
fmt_out lately. This is the case for dts-hd for example (first decoder/encoder
initialisation gives 5.1, then 7.1).

(cherry picked from commit 91c3b27e)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4f91a099
......@@ -307,6 +307,13 @@ int transcode_audio_process( sout_stream_t *p_stream,
}
date_Init( &id->next_input_pts, id->audio_dec_out.i_rate, 1 );
date_Set( &id->next_input_pts, p_audio_buf->i_pts );
if (!id->id)
{
id->id = sout_StreamIdAdd( p_stream->p_next, &id->p_encoder->fmt_out );
if (!id->id)
id->b_transcode = false;
}
}
/* Check if audio format has changed, and filters need reinit */
......@@ -426,15 +433,8 @@ bool transcode_audio_add( sout_stream_t *p_stream, const es_format_t *p_fmt,
}
/* Open output stream */
id->id = sout_StreamIdAdd( p_stream->p_next, &id->p_encoder->fmt_out );
id->b_transcode = true;
if( !id->id )
{
transcode_audio_close( id );
return false;
}
/* Reinit encoder again later on, when all information from decoders
* is available. */
if( id->p_encoder->p_module )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment