Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
7ebda35a by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: dmxmus: check es

- - - - -
4b82fa49 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: ty: check es

- - - - -
71aef543 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: image: check es

- - - - -
af2163c4 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: pva: check es

- - - - -
01a9aaf9 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: rawaud: check es

- - - - -
f3f150ad by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: rawdv: check es

- - - - -
0f48e829 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: rawvid: check es

- - - - -
d9c7cdae by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: sid: check es

- - - - -
3b647d40 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: smf: check es

- - - - -
ac0f9954 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: tta: check es

- - - - -
aa66fb45 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: vc1: check es

- - - - -
87d45c8e by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: vobsub: check es

- - - - -
b3c28b77 by François Cartegnie at 2026-02-14T02:55:52+00:00
demux: es: check es

- - - - -


13 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/ty.c
- modules/demux/vc1.c
- modules/demux/vobsub.c


Changes:

=====================================
modules/demux/dmxmus.c
=====================================
@@ -460,6 +460,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
=====================================
@@ -802,16 +802,21 @@ 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, VLC_TICK_0);
+    sys->es = es_out_Add(demux->out, &fmt);
+    es_format_Clean(&fmt);
+    if(unlikely(!sys->es))
+    {
+        if (data)
+            block_Release(data);
+        return VLC_EGENERIC;
+    }
     sys->data        = data;
-    sys->es          = es_out_Add(demux->out, &fmt);
     sys->duration    = vlc_tick_from_sec( var_InheritFloat(demux, 
"image-duration") );
     sys->is_realtime = var_InheritBool(demux, "image-realtime");
     sys->pts_offset  = sys->is_realtime ? vlc_tick_now() : 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, VLC_TICK_0);
-
-    es_format_Clean(&fmt);
 
     demux->pf_demux   = Demux;
     demux->pf_control = Control;


=====================================
modules/demux/mpeg/es.c
=====================================
@@ -593,7 +593,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
=====================================
@@ -223,7 +223,12 @@ static int Demux( demux_t *p_demux )
 
                     p_frame = block_ChainGather( p_frame );
                     if( likely(p_frame) )
-                        es_out_Send( p_demux->out, p_sys->p_video, 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;
                 }
@@ -455,5 +460,8 @@ 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
=====================================
@@ -187,6 +187,12 @@ static int Open( vlc_object_t * p_this )
     /* add the es */
     p_sys->fmt.i_id = 0;
     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
=====================================
@@ -245,7 +245,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 )
     {
@@ -259,23 +258,26 @@ static int Demux( demux_t *p_demux )
     if( p_block == NULL )
         return VLC_DEMUXER_EOF;
 
-    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
=====================================
@@ -360,6 +360,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
=====================================
@@ -167,6 +167,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, VLC_TICK_0);


=====================================
modules/demux/smf.c
=====================================
@@ -708,6 +708,8 @@ static int Open (vlc_object_t *obj)
     fmt.audio.i_rate = 44100; /* dummy value */
     fmt.i_id = 0;
     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
=====================================
@@ -167,6 +167,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/ty.c
=====================================
@@ -819,7 +819,10 @@ static int DemuxRecVideo( demux_t *p_demux, ty_rec_hdr_t 
*rec_hdr, block_t *p_bl
 
     //msg_Dbg(p_demux, "sending rec %d as video type 0x%02x",
             //p_sys->i_cur_rec, subrec_type);
-    es_out_Send(p_demux->out, p_sys->p_video, p_block_in);
+    if( likely(p_sys->p_video) )
+        es_out_Send(p_demux->out, p_sys->p_video, p_block_in);
+    else
+        block_Release( p_block_in );
     return 0;
 }
 static int DemuxRecAudio( demux_t *p_demux, ty_rec_hdr_t *rec_hdr, block_t 
*p_block_in )
@@ -1018,7 +1021,10 @@ static int DemuxRecAudio( demux_t *p_demux, ty_rec_hdr_t 
*rec_hdr, block_t *p_bl
         es_out_SetPCR( p_demux->out, p_block_in->i_pts );
 
     /* Send data */
-    es_out_Send( p_demux->out, p_sys->p_audio, p_block_in );
+    if( likely(p_sys->p_audio) )
+        es_out_Send( p_demux->out, p_sys->p_audio, p_block_in );
+    else
+        block_Release( p_block_in );
     return 0;
 }
 


=====================================
modules/demux/vc1.c
=====================================
@@ -173,7 +173,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
=====================================
@@ -249,10 +249,11 @@ static int Control( demux_t *p_demux, int i_query, 
va_list args )
         case DEMUX_GET_TIME:
             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 )
@@ -282,10 +283,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/79fc3824fff5fe9f0961314719c06baca2879d73...b3c28b77326135cca9f05f7e7c4e5b1dd6618502

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


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to