Commit 49b3b98b authored by Jai Menon's avatar Jai Menon Committed by Jean-Baptiste Kempf

AVCodec : Allow delayed opening of audio codecs.

Additionally, enable delayed opening for AAC which fixes decoding
of media where we rely on decoder configuration being supplied by
the packetizer instead of the container.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 62330410
......@@ -159,7 +159,7 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_codec = p_codec;
p_sys->i_codec_id = i_codec_id;
p_sys->psz_namecodec = psz_namecodec;
p_sys->b_delayed_open = false;
p_sys->b_delayed_open = true;
// Initialize decoder extradata
InitDecoderConfig( p_dec, p_context);
......@@ -265,6 +265,19 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
if( !p_sys->p_context->extradata_size && p_dec->fmt_in.i_extra &&
p_sys->b_delayed_open)
{
InitDecoderConfig( p_dec, p_sys->p_context);
if( ffmpeg_OpenCodec( p_dec ) )
msg_Err( p_dec, "Cannot open decoder %s", p_sys->psz_namecodec );
}
if( p_sys->b_delayed_open )
{
block_Release( p_block );
return NULL;
}
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
block_Release( p_block );
......
......@@ -409,7 +409,8 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
{
if( p_sys->i_codec_id == CODEC_ID_VC1 ||
p_sys->i_codec_id == CODEC_ID_VORBIS ||
p_sys->i_codec_id == CODEC_ID_THEORA )
p_sys->i_codec_id == CODEC_ID_THEORA ||
p_sys->i_codec_id == CODEC_ID_AAC )
{
msg_Warn( p_dec, "waiting for extra data for codec %s",
p_sys->psz_namecodec );
......
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