[vlc-commits] packetizer: mpeg4video: workaround missing modulo_time_base
Francois Cartegnie
git at videolan.org
Wed Aug 8 13:49:13 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Aug 7 20:13:00 2018 +0200| [bc243c4db9d32bcc6d2af35f06d14880c738d79b] | committer: Francois Cartegnie
packetizer: mpeg4video: workaround missing modulo_time_base
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc243c4db9d32bcc6d2af35f06d14880c738d79b
---
modules/packetizer/mpeg4video.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index a3303fcd8c..5a0f53abe3 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -532,6 +532,15 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
(i_modulo_time_base * p_sys->i_fps_num);
}
+ int64_t i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
+ if( p_sys->i_fps_num && i_modulo_time_base == 0 && i_time_diff < 0 && -i_time_diff > p_sys->i_fps_num )
+ {
+ msg_Warn(p_dec, "missing modulo_time_base update");
+ i_modulo_time_base += -i_time_diff / p_sys->i_fps_num;
+ p_sys->i_time_ref += (i_modulo_time_base * p_sys->i_fps_num);
+ p_sys->i_time_ref += p_sys->i_last_timeincr % p_sys->i_fps_num;
+ i_time_ref = p_sys->i_time_ref;
+ }
if( p_sys->i_fps_num < 5 && /* Work-around buggy streams */
p_dec->fmt_in.video.i_frame_rate > 0 &&
@@ -542,10 +551,10 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
p_dec->fmt_in.video.i_frame_rate;
}
else if( p_sys->i_fps_num )
- p_sys->i_interpolated_pts +=
- ( CLOCK_FREQ * (i_time_ref + i_time_increment -
- p_sys->i_last_time - p_sys->i_last_timeincr) /
- p_sys->i_fps_num );
+ {
+ i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
+ p_sys->i_interpolated_pts += ( CLOCK_FREQ * i_time_diff / p_sys->i_fps_num );
+ }
#if 0
msg_Err( p_dec, "interp dts/pts (%"PRId64",%"PRId64"), dts/pts (%"PRId64",%"PRId64") %"PRId64" mod %d inc %"PRId64,
More information about the vlc-commits
mailing list