Skip to content
Snippets Groups Projects
Commit d906e3e7 authored by François Cartegnie's avatar François Cartegnie :fingers_crossed: Committed by Steve Lhomme
Browse files

codec: faad: workaround unaligned timings

(cherry picked from commit c8d7729a)
parent 3bfe4f14
No related branches found
No related tags found
2 merge requests!3533Backport MR 3236 to 3.0.x,!2719[3.0] codec: faad: backport fixes
......@@ -72,6 +72,7 @@ struct decoder_sys_t
/* samples */
date_t date;
mtime_t i_last_length;
/* temporary buffer */
block_t *p_block;
......@@ -176,6 +177,8 @@ static int Open( vlc_object_t *p_this )
cfg->outputFormat = HAVE_FPU ? FAAD_FMT_FLOAT : FAAD_FMT_16BIT;
NeAACDecSetConfiguration( p_sys->hfaad, cfg );
p_sys->i_last_length = 0;
/* buffer */
p_sys->p_block = NULL;
......@@ -323,7 +326,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
if( i_pts > VLC_TS_INVALID && i_pts != date_Get( &p_sys->date ) )
{
date_Set( &p_sys->date, i_pts );
if( p_sys->i_last_length == 0 ||
/* We need to be permissive and rebase dts when it's really way off */
llabs( i_pts - date_Get( &p_sys->date ) ) > p_sys->i_last_length * 3 / 2 )
date_Set( &p_sys->date, i_pts );
}
else if( !date_Get( &p_sys->date ) )
{
......@@ -560,7 +566,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_out->i_length = date_Increment( &p_sys->date,
frame.samples / frame.channels )
- p_out->i_pts;
p_sys->i_last_length = p_out->i_length;
if ( p_dec->fmt_out.audio.channel_type == AUDIO_CHANNEL_TYPE_BITMAP )
{
/* Don't kill speakers if some weird mapping does not gets 1:1 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment