[vlc-commits] [Git][videolan/vlc][3.0.x] 12 commits: demux: dmxmus: check es

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Thu Apr 16 08:14:42 UTC 2026



Felix Paul Kühne pushed to branch 3.0.x at VideoLAN / VLC


Commits:
19f3f29c by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: dmxmus: check es

(cherry picked from commit 7ebda35a399a4190a03f8c0410137423025d66df)

- - - - -
27e41142 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: image: check es

(cherry picked from commit 71aef54364843209538c36be895c3e8e36516c79)
(cherry picked from commit 093ad617ba0bf1bf4fc34517dfc8f737a561c3bd)

- - - - -
0e542230 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: pva: check es

(cherry picked from commit af2163c44b1f9e0d7673b63b00bca7399a1b18af)

- - - - -
dfd91326 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: rawaud: check es

(cherry picked from commit 01a9aaf9a5ff143d9e9488c26618c1f077c8e5d4)

- - - - -
54098f85 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: rawdv: check es

(cherry picked from commit f3f150ad34ddf7577fdc96ba263bbbe9f6d37d1c)

- - - - -
605b1fe4 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: rawvid: check es

(cherry picked from commit 0f48e829c808735ecd08761a8ab42afea8a55b17)

- - - - -
20453d47 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: sid: check es

(cherry picked from commit d9c7cdaef66345a6e4cadc1ada581aec1f28291d)

- - - - -
33b37bd0 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: smf: check es

(cherry picked from commit 3b647d4010cac4de9acedc7ab908edbaf59f5da2)

- - - - -
6302033c by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: tta: check es

(cherry picked from commit ac0f99543937c6c6e717466d8697db2fd3ee7e26)

- - - - -
a3f2a886 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: vc1: check es

(cherry picked from commit aa66fb45a22a790d804a83a63ae2b11ebc277928)

- - - - -
8d9bc9de by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: vobsub: check es

(cherry picked from commit 87d45c8e546329920205b965ae6324aa477abb37)

- - - - -
cd4bc078 by François Cartegnie at 2026-04-16T07:33:22+00:00
demux: es: check es

(cherry picked from commit b3c28b77326135cca9f05f7e7c4e5b1dd6618502)

- - - - -


12 changed files:

- modules/demux/dmxmus.c
- modules/demux/image.c
- modules/demux/mpeg/es.c
- modules/demux/pva.c
- modules/demux/rawaud.c
- modules/demux/rawdv.c
- modules/demux/rawvid.c
- modules/demux/sid.cpp
- modules/demux/smf.c
- modules/demux/tta.c
- modules/demux/vc1.c
- modules/demux/vobsub.c


Changes:

=====================================
modules/demux/dmxmus.c
=====================================
@@ -388,6 +388,8 @@ static int Open(vlc_object_t *obj)
     fmt.audio.i_channels = 2;
     fmt.audio.i_rate = 44100;
     sys->es = es_out_Add(demux->out, &fmt);
+    if(unlikely(!sys->es))
+        return VLC_EGENERIC;
 
     date_Init(&sys->pts, MUS_FREQ, 1);
     date_Set(&sys->pts, VLC_TICK_0);


=====================================
modules/demux/image.c
=====================================
@@ -741,16 +741,22 @@ static int Open(vlc_object_t *object)
         return VLC_ENOMEM;
     }
 
+    date_Init(&sys->pts, fmt.video.i_frame_rate, fmt.video.i_frame_rate_base);
+    date_Set(&sys->pts, 0);
+    sys->es = es_out_Add(demux->out, &fmt);
+    es_format_Clean(&fmt);
+    if(unlikely(!sys->es))
+    {
+        if (data)
+            block_Release(data);
+        free(sys);
+        return VLC_EGENERIC;
+    }
     sys->data        = data;
-    sys->es          = es_out_Add(demux->out, &fmt);
     sys->duration    = CLOCK_FREQ * var_InheritFloat(demux, "image-duration");
     sys->is_realtime = var_InheritBool(demux, "image-realtime");
     sys->pts_origin  = sys->is_realtime ? mdate() : 0;
     sys->pts_next    = VLC_TICK_INVALID;
-    date_Init(&sys->pts, fmt.video.i_frame_rate, fmt.video.i_frame_rate_base);
-    date_Set(&sys->pts, 0);
-
-    es_format_Clean(&fmt);
 
     demux->pf_demux   = Demux;
     demux->pf_control = Control;


=====================================
modules/demux/mpeg/es.c
=====================================
@@ -356,7 +356,10 @@ static int Demux( demux_t *p_demux )
 
 
         p_block_out->p_next = NULL;
-        es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
+        if( likely(p_sys->p_es) )
+            es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
+        else
+            block_Release( p_block_out );
 
         p_block_out = p_next;
     }


=====================================
modules/demux/pva.c
=====================================
@@ -222,9 +222,14 @@ static int Demux( demux_t *p_demux )
                     }
 
                     p_frame = block_ChainGather( p_frame );
-                    if( unlikely(p_frame == NULL) )
-                        abort();
-                    es_out_Send( p_demux->out, p_sys->p_video, p_frame );
+
+                    if( likely(p_frame) )
+                    {
+                        if( likely(p_sys->p_video) )
+                            es_out_Send( p_demux->out, p_sys->p_video, p_frame );
+                        else
+                            block_Release( p_frame );
+                    }
 
                     p_sys->p_es = NULL;
                 }
@@ -454,6 +459,9 @@ static void ParsePES( demux_t *p_demux )
         es_out_SetPCR( p_demux->out, p_pes->i_pts);
         p_sys->b_pcr_audio = true;
     }
-    es_out_Send( p_demux->out, p_sys->p_audio, p_pes );
+    if( likely(p_sys->p_audio) )
+        es_out_Send( p_demux->out, p_sys->p_audio, p_pes );
+    else
+        block_Release( p_pes );
 }
 


=====================================
modules/demux/rawaud.c
=====================================
@@ -204,6 +204,12 @@ static int Open( vlc_object_t * p_this )
 
     /* add the es */
     p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
+    if( unlikely(!p_sys->p_es) )
+    {
+        es_format_Clean( &p_sys->fmt );
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
     msg_Dbg( p_demux, "elementary stream added");
 
     /* initialize timing */


=====================================
modules/demux/rawdv.c
=====================================
@@ -254,7 +254,6 @@ static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys  = p_demux->p_sys;
     block_t     *p_block;
-    bool  b_audio = false;
 
     if( p_sys->b_hurry_up )
     {
@@ -271,23 +270,26 @@ static int Demux( demux_t *p_demux )
         return 0;
     }
 
-    if( p_sys->p_es_audio )
-    {
-        es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
-                        p_sys->p_es_audio, &b_audio );
-    }
-
     p_block->i_dts =
     p_block->i_pts = VLC_TICK_0 + p_sys->i_pcr;
 
-    if( b_audio )
+    if( likely(p_sys->p_es_audio) )
     {
-        block_t *p_audio_block = dv_extract_audio( p_block );
-        if( p_audio_block )
-            es_out_Send( p_demux->out, p_sys->p_es_audio, p_audio_block );
+        bool b_audio = false;
+        es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
+                        p_sys->p_es_audio, &b_audio );
+        if( b_audio )
+        {
+            block_t *p_audio_block = dv_extract_audio( p_block );
+            if( p_audio_block )
+                es_out_Send( p_demux->out, p_sys->p_es_audio, p_audio_block );
+        }
     }
 
-    es_out_Send( p_demux->out, p_sys->p_es_video, p_block );
+    if( likely(p_sys->p_es_video) )
+        es_out_Send( p_demux->out, p_sys->p_es_video, p_block );
+    else
+        block_Release( p_block );
 
     if( !p_sys->b_hurry_up )
     {


=====================================
modules/demux/rawvid.c
=====================================
@@ -363,6 +363,8 @@ valid:
         p_sys->frame_size += pitch * lines;
     }
     p_sys->p_es_video = es_out_Add( p_demux->out, &p_sys->fmt_video );
+    if( unlikely(!p_sys->p_es_video) )
+        goto error;
 
     p_demux->pf_demux   = Demux;
     p_demux->pf_control = Control;


=====================================
modules/demux/sid.cpp
=====================================
@@ -161,6 +161,8 @@ static int Open (vlc_object_t *obj)
     fmt.i_bitrate = fmt.audio.i_rate * fmt.audio.i_bytes_per_frame;
 
     sys->es = es_out_Add (demux->out, &fmt);
+    if( unlikely(!sys->es) )
+        goto error;
 
     date_Init (&sys->pts, fmt.audio.i_rate, 1);
     date_Set (&sys->pts, 0);


=====================================
modules/demux/smf.c
=====================================
@@ -700,6 +700,8 @@ static int Open (vlc_object_t *obj)
     fmt.audio.i_channels = 2;
     fmt.audio.i_rate = 44100; /* dummy value */
     sys->es = es_out_Add (demux->out, &fmt);
+    if( unlikely(!sys->es) )
+        goto error;
 
     demux->pf_demux = Demux;
     demux->pf_control = Control;


=====================================
modules/demux/tta.c
=====================================
@@ -169,6 +169,9 @@ static int Open( vlc_object_t * p_this )
     p_fullheader += 4;
 
     p_sys->p_es = es_out_Add( p_demux->out, &fmt );
+    if( unlikely(!p_sys->p_es) )
+        goto error;
+
     p_sys->i_start = p_fullheader - (uint8_t *)fmt.p_extra;
     es_format_Clean( &fmt );
 


=====================================
modules/demux/vc1.c
=====================================
@@ -174,7 +174,13 @@ static int Demux( demux_t *p_demux)
             p_block_out->i_dts = VLC_TICK_0 + p_sys->i_dts;
             p_block_out->i_pts = VLC_TICK_0 + p_sys->i_dts;
 
-            es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
+            if( likely(p_sys->p_es) )
+                es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
+            else
+            {
+                block_Release( p_block_out );
+                b_eof = true;
+            }
 
             p_block_out = p_next;
 


=====================================
modules/demux/vobsub.c
=====================================
@@ -254,10 +254,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = va_arg( args, int64_t * );
             for( i = 0; i < p_sys->i_tracks; i++ )
             {
-                bool b_selected;
+                bool b_selected = false;
                 /* Check the ES is selected */
-                es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
-                                p_sys->track[i].p_es, &b_selected );
+                if( likely(p_sys->track[i].p_es) )
+                    es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
+                                    p_sys->track[i].p_es, &b_selected );
                 if( b_selected ) break;
             }
             if( i < p_sys->i_tracks && p_sys->track[i].i_current_subtitle < p_sys->track[i].i_subtitles )
@@ -287,10 +288,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pf = va_arg( args, double * );
             for( i = 0; i < p_sys->i_tracks; i++ )
             {
-                bool b_selected;
+                bool b_selected = false;
                 /* Check the ES is selected */
-                es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
-                                p_sys->track[i].p_es, &b_selected );
+                if( likely(p_sys->track[i].p_es) )
+                    es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE,
+                                    p_sys->track[i].p_es, &b_selected );
                 if( b_selected ) break;
             }
             if (i >= p_sys->i_tracks) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/71f0a19e629886ae109d626fe0d6b87fcae017b7...cd4bc078dcd6438d991e5d7ace4070d03189a131

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/71f0a19e629886ae109d626fe0d6b87fcae017b7...cd4bc078dcd6438d991e5d7ace4070d03189a131
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list