[vlc-devel] [PATCH 1/2] input: fix dead code

Thomas Guillem thomas at gllm.fr
Wed Jul 18 13:14:26 CEST 2018


Could it be possible ? A regression from 2004, cf.
997c6c3419170b68d41ff8ee5b27b26166138984

First, "sub-original-fps" is useless, since the subtitle demuxer (only user)
will always override this value with "sub-fps".

Secondly, var_Create( p_input, "sub-fps" ) is useless since var_CreateGetFloat
is doing the same thing 3 lines before.

Finally, var_SetFloat( p_input, "sub-fps", f_requested_fps ) is useless since
f_requested_fps is already the value of this variable. I guess it's an
error/typo, the original commiter meant to override "sub-fps" with the fps of
the master demux (f_fps), no ?

This commit will cause the "sub-fps" to be always valid (with the user choice,
or the master demux fps). Before this commit, it was only valid if the user set
it. Are there possible regressions ?
---
 src/input/input.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 76abd780a3..f5a7c207c4 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -978,16 +978,9 @@ static void SetSubtitlesOptions( input_thread_t *p_input )
     const float f_fps = input_priv(p_input)->master->f_fps;
     if( f_fps > 1.f )
     {
-        var_Create( p_input, "sub-original-fps", VLC_VAR_FLOAT );
-        var_SetFloat( p_input, "sub-original-fps", f_fps );
-
         float f_requested_fps = var_CreateGetFloat( p_input, "sub-fps" );
-        if( f_requested_fps != f_fps )
-        {
-            var_Create( p_input, "sub-fps", VLC_VAR_FLOAT|
-                                            VLC_VAR_DOINHERIT );
-            var_SetFloat( p_input, "sub-fps", f_requested_fps );
-        }
+        if( f_requested_fps <= 1.f )
+            var_SetFloat( p_input, "sub-fps", f_fps );
     }
 
     const int i_delay = var_CreateGetInteger( p_input, "sub-delay" );
-- 
2.18.0



More information about the vlc-devel mailing list