[vlc-devel] [PATCH] decoder: don't request a vout in loop

Thomas Guillem thomas at gllm.fr
Fri Sep 23 17:16:09 CEST 2016


Don't try to request a vout if it previously failed. A new vout will be
requested if the fmt_out changes. This save a *lot* of CPU cycles when playing
a sample with an invalid fmt_out.
---
 src/input/decoder.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index a736143..d44789e 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -369,8 +369,7 @@ static int vout_update_format( decoder_t *p_dec )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
-    if( p_owner->p_vout == NULL
-     || p_dec->fmt_out.video.i_width != p_owner->fmt.video.i_width
+    if( p_dec->fmt_out.video.i_width != p_owner->fmt.video.i_width
      || p_dec->fmt_out.video.i_height != p_owner->fmt.video.i_height
      || p_dec->fmt_out.video.i_visible_width != p_owner->fmt.video.i_visible_width
      || p_dec->fmt_out.video.i_visible_height != p_owner->fmt.video.i_visible_height
@@ -492,6 +491,8 @@ static int vout_update_format( decoder_t *p_dec )
             return -1;
         }
     }
+    else if( p_owner->p_vout == NULL )
+        return -1;
     return 0;
 }
 
-- 
2.9.3



More information about the vlc-devel mailing list