[vlc-commits] decoder: return early in decoder_UpdateVideoFormat()

Steve Lhomme git at videolan.org
Mon Feb 18 16:21:23 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 18 15:58:10 2019 +0100| [1f548bdd1c058f376670eed57de5e18333e04acd] | committer: Steve Lhomme

decoder: return early in decoder_UpdateVideoFormat()

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

 src/input/decoder_helpers.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index ff1ae04b81..315cd1d22c 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -76,10 +76,11 @@ void decoder_Destroy( decoder_t **p_dec )
 int decoder_UpdateVideoFormat( decoder_t *dec )
 {
     vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
+    if ( unlikely(dec->fmt_in.i_cat != VIDEO_ES || dec->cbs == NULL ||
+                  dec->cbs->video.format_update == NULL) )
+        return -1;
 
-    if( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs->video.format_update != NULL )
-        return dec->cbs->video.format_update( dec );
-    return -1;
+    return dec->cbs->video.format_update( dec );
 }
 
 picture_t *decoder_NewPicture( decoder_t *dec )



More information about the vlc-commits mailing list