[vlc-commits] mjpeg: check ES just once

Rémi Denis-Courmont git at videolan.org
Thu May 3 19:13:34 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May  3 20:11:39 2018 +0300| [ddc1908ed952a4df1d0e02f730d24b918f9e7bb2] | committer: Rémi Denis-Courmont

mjpeg: check ES just once

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ddc1908ed952a4df1d0e02f730d24b918f9e7bb2
---

 modules/demux/mjpeg.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index f47311fd44..d0355f35ea 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -278,12 +278,8 @@ static int SendBlock( demux_t *p_demux, int i )
     }
     p_block->i_dts = p_block->i_pts;
 
-    /* set PCR */
     es_out_SetPCR( p_demux->out, p_block->i_pts );
-    if( p_sys->p_es )
-        es_out_Send( p_demux->out, p_sys->p_es, p_block );
-    else
-        block_Release( p_block );
+    es_out_Send( p_demux->out, p_sys->p_es, p_block );
 
     if( p_sys->b_still )
         p_sys->i_still_end = mdate() + p_sys->i_frame_length;
@@ -387,6 +383,8 @@ static int Open( vlc_object_t * p_this )
     es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_MJPG );
 
     p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
+    if( unlikely(p_sys->p_es == NULL) )
+        return VLC_ENOMEM;
 
     p_demux->pf_control = Control;
     return VLC_SUCCESS;



More information about the vlc-commits mailing list