[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: ogg: account total number of streams separately

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Sep 19 08:47:16 UTC 2026



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
700ad50b by François Cartegnie at 2026-09-19T10:22:46+02:00
demux: ogg: account total number of streams separately

fixes #30126
Stream continuity regression with 1 valid and 1+ unsupported streams

- - - - -
7bfe24d3 by François Cartegnie at 2026-09-19T10:22:46+02:00
demux: ogg: add total number of streams guard

- - - - -


2 changed files:

- modules/demux/ogg.c
- modules/demux/ogg.h


Changes:

=====================================
modules/demux/ogg.c
=====================================
@@ -418,7 +418,7 @@ static int Demux( demux_t * p_demux )
 
             /* We keep the ES to try reusing it in Ogg_BeginningOfStream
              * only 1 ES is supported (common case for ogg web radio) */
-            if( p_sys->i_streams == 1 && p_sys->pp_stream[0]->p_es )
+            if( p_sys->i_streams == 1 && p_sys->i_declared_streams == 1 && p_sys->pp_stream[0]->p_es )
             {
                 if( p_sys->p_old_stream ) /* if no setupEs has reused */
                     Ogg_LogicalStreamDelete( p_demux, p_sys->p_old_stream );
@@ -517,7 +517,7 @@ static int Demux( demux_t * p_demux )
         /* if we've just pulled page, look for the right logical stream */
         if( !p_sys->b_page_waiting )
         {
-            if( p_sys->i_streams == 1 &&
+            if( p_sys->i_streams == 1 && p_sys->i_declared_streams == 1 &&
                 ogg_page_serialno( &p_sys->current_page ) != p_stream->os.serialno )
             {
                 msg_Err( p_demux, "Broken Ogg stream (serialno) mismatch" );
@@ -1693,6 +1693,12 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
             return p_ogg->i_streams ? VLC_SUCCESS : VLC_EGENERIC;
         }
 
+        if( unlikely(p_ogg->i_declared_streams == INT_MAX) )
+            return VLC_EGENERIC;
+
+         /* New BOS, so new stream */
+        p_ogg->i_declared_streams++;
+
         /* Try to configure the new stream */
         logical_stream_t *p_stream = Ogg_FindLogicalStream( p_demux, &p_ogg->current_page );
         if( unlikely( !p_stream ) )
@@ -2329,6 +2335,7 @@ static void Ogg_EndOfStream( demux_t *p_demux )
     /* Reinit p_ogg */
     p_ogg->i_bitrate = 0;
     p_ogg->i_streams = 0;
+    p_ogg->i_declared_streams = 0;
     p_ogg->pp_stream = NULL;
     p_ogg->skeleton.major = 0;
     p_ogg->skeleton.minor = 0;


=====================================
modules/demux/ogg.h
=====================================
@@ -171,7 +171,8 @@ typedef struct
 {
     ogg_sync_state oy;        /* sync and verify incoming physical bitstream */
 
-    int i_streams;                           /* number of logical bitstreams */
+    int i_declared_streams;   /* total number of streams, including unsupported ones */
+    int i_streams;            /* effectively created logical_steams_t with ES. <= i_declared_streams */
     logical_stream_t **pp_stream;  /* pointer to an array of logical streams */
     logical_stream_t *p_skelstream; /* pointer to skeleton stream if any */
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3e5d7492a6294993419e997c8ac0ca8ae5746d94...7bfe24d309f3cb8cbf97e5770db83c02c667aedd

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3e5d7492a6294993419e997c8ac0ca8ae5746d94...7bfe24d309f3cb8cbf97e5770db83c02c667aedd
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