[vlc-commits] [Git][videolan/vlc][master] demux: mp4: avoid using sbgp if *pi_sync_sample was not modified

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 16 07:52:24 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
07a2ad66 by Steve Lhomme at 2026-01-16T07:26:38+00:00
demux: mp4: avoid using sbgp if *pi_sync_sample was not modified

*pi_sync_sample can never be modified in that code block if *pi_sync_sample == i_sample.

No need to set the return value as we can only get in this block if the previous one was successful.

- - - - -


1 changed file:

- modules/demux/mp4/mp4.c


Changes:

=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -3413,17 +3413,19 @@ static int TrackGetNearestSeekPoint( demux_t *p_demux, mp4_track_t *p_track,
         }
     }
 
-    /* try or refine using RAP with recovery roll info */
-    uint32_t i_alternative_sync_sample = i_sample;
-    if( MP4_SampleToGroupInfo( p_track->p_stbl, i_sample, SAMPLEGROUP_rap,
-                               0, &i_alternative_sync_sample, true, NULL ) )
-    {
-        i_ret = VLC_SUCCESS;
-        msg_Dbg( p_demux, "tk %u sbgp gives %d --> %" PRIu32 " (sample number)",
-                 p_track->i_track_ID, i_sample, i_alternative_sync_sample );
-        if( i_alternative_sync_sample > *pi_sync_sample &&
-            i_alternative_sync_sample < i_sample )
-            *pi_sync_sample = i_alternative_sync_sample;
+    if (*pi_sync_sample != i_sample)
+    {
+        /* try or refine using RAP with recovery roll info */
+        uint32_t i_alternative_sync_sample = i_sample;
+        if( MP4_SampleToGroupInfo( p_track->p_stbl, i_sample, SAMPLEGROUP_rap,
+                                0, &i_alternative_sync_sample, true, NULL ) )
+        {
+            msg_Dbg( p_demux, "tk %u sbgp gives %d --> %" PRIu32 " (sample number)",
+                    p_track->i_track_ID, i_sample, i_alternative_sync_sample );
+            if( i_alternative_sync_sample > *pi_sync_sample &&
+                i_alternative_sync_sample < i_sample )
+                *pi_sync_sample = i_alternative_sync_sample;
+        }
     }
 
     return i_ret;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/07a2ad663da8631e904f22b0deee29de96a38bca

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/07a2ad663da8631e904f22b0deee29de96a38bca
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list