[vlc-commits] [Git][videolan/vlc][master] 5 commits: Revert "mpeg4video: add early check on zero i_fps_num"
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Aug 27 12:56:05 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
6e1c3e62 by Steve Lhomme at 2026-08-27T12:46:47+00:00
Revert "mpeg4video: add early check on zero i_fps_num"
This reverts commit 28a958d3b4180941c85a70509e73807c4fd7094c.
Before this patch the code could (almost) reach the end normally.
- - - - -
42a669af by Steve Lhomme at 2026-08-27T12:46:47+00:00
packetizer: mpeg4video: refactor i_fps_num testing
i_time_diff is only computed if it's going to be used.
And it's always when i_fps_num is not 0.
- - - - -
9b2eeb8c by Steve Lhomme at 2026-08-27T12:46:47+00:00
packetizer: mpeg4video: only compute i_time_increment when i_fps_num is not 0
It's uninitialized otherwise. And it's not used anyway in that case.
We don't store it in i_last_timeincr either when it's not set. The initial
value 0 until a valid (non zero) i_fps_num is set.
Fixes #29756
- - - - -
c2519c8e by Steve Lhomme at 2026-08-27T12:46:47+00:00
packetizer: mpeg4video: remove always true test
i_fps_num is unsigned, so if it's not smaller than 5, it's a least 5.
- - - - -
30d249bf by Steve Lhomme at 2026-08-27T12:46:47+00:00
packetizer: mpeg4video: add reference to the spec
- - - - -
1 changed file:
- modules/packetizer/mpeg4video.c
Changes:
=====================================
modules/packetizer/mpeg4video.c
=====================================
@@ -503,9 +503,6 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
uint64_t i_modulo_time_base = 0;
bs_t s;
- if( p_sys->i_fps_num == 0 )
- return VLC_EGENERIC;
-
bs_init( &s, &p_vop->p_buffer[4], p_vop->i_buffer - 4 );
switch( bs_read( &s, 2 ) )
@@ -520,7 +517,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
p_sys->i_flags = BLOCK_FLAG_TYPE_B;
p_sys->b_frame = true;
break;
- case 3: /* gni ? */
+ case 3: /* Sprite : ISO 14496-2 § 6.3.5 */
p_sys->i_flags = BLOCK_FLAG_TYPE_PB;
break;
}
@@ -528,10 +525,6 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
while( bs_read( &s, 1 ) ) i_modulo_time_base++;
if( !bs_read1( &s ) ) return VLC_EGENERIC; /* Marker */
- /* VOP time increment */
- unsigned i_time_increment_bits = vlc_log2(p_sys->i_fps_num - 1) + 1;
- i_time_increment = bs_read( &s, i_time_increment_bits );
-
/* Interpolate PTS/DTS */
if( !(p_sys->i_flags & BLOCK_FLAG_TYPE_B) )
{
@@ -546,14 +539,21 @@ 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( i_modulo_time_base == 0 && i_time_diff < 0 && -i_time_diff > p_sys->i_fps_num )
+ if( 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;
+ /* VOP time increment */
+ unsigned i_time_increment_bits = vlc_log2(p_sys->i_fps_num - 1) + 1;
+ i_time_increment = bs_read( &s, i_time_increment_bits );
+
+ int64_t i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
+ if( 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 */
@@ -566,7 +566,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
}
else
{
- i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
+ int64_t i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
p_sys->i_interpolated_pts += vlc_tick_from_samples( i_time_diff, p_sys->i_fps_num );
}
@@ -577,7 +577,8 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
#endif
p_sys->i_last_time = i_time_ref;
- p_sys->i_last_timeincr = i_time_increment;
+ if( p_sys->i_fps_num )
+ p_sys->i_last_timeincr = i_time_increment;
/* Correct interpolated dts when we receive a new pts/dts */
if( p_vop->i_pts != VLC_TICK_INVALID )
@@ -608,4 +609,3 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
return VLC_SUCCESS;
}
-
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6061ca97d97f3f14303c6ae99490f49525da0c7d...30d249bf511fd9c2a6168866175fe3c8a6f89b1d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6061ca97d97f3f14303c6ae99490f49525da0c7d...30d249bf511fd9c2a6168866175fe3c8a6f89b1d
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list