[vlc-commits] packetizer: a52: fix repeating timestamps on time resync
Francois Cartegnie
git at videolan.org
Tue Dec 1 17:00:07 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 30 11:20:01 2020 +0100| [36e2465e462d65232be14a6aaac4a85dc7ce6b41] | committer: Francois Cartegnie
packetizer: a52: fix repeating timestamps on time resync
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=36e2465e462d65232be14a6aaac4a85dc7ce6b41
---
modules/packetizer/a52.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/packetizer/a52.c b/modules/packetizer/a52.c
index 15890af14b..bf30edaa61 100644
--- a/modules/packetizer/a52.c
+++ b/modules/packetizer/a52.c
@@ -109,9 +109,15 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
/* Make sure we don't reuse the same pts twice
* as A/52 in PES sends multiple times the same pts */
if( p_sys->bytestream.p_block->i_pts != p_sys->i_prev_bytestream_pts )
- date_Set( &p_sys->end_date, p_sys->bytestream.p_block->i_pts );
- p_sys->i_prev_bytestream_pts = p_sys->bytestream.p_block->i_pts;
- p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ {
+ date_t tempdate = p_sys->end_date;
+ date_Increment( &tempdate, p_sys->frame.i_samples );
+ vlc_tick_t samplesduration = date_Get( &tempdate ) - date_Get( &p_sys->end_date );
+ if( llabs(p_sys->bytestream.p_block->i_pts - date_Get( &p_sys->end_date )) > samplesduration )
+ date_Set( &p_sys->end_date, p_sys->bytestream.p_block->i_pts );
+ p_sys->i_prev_bytestream_pts = p_sys->bytestream.p_block->i_pts;
+ p_sys->bytestream.p_block->i_pts = VLC_TICK_INVALID;
+ }
}
p_dec->fmt_out.audio.i_rate = p_sys->frame.i_rate;
More information about the vlc-commits
mailing list