[vlc-commits] gui: remove useless checks for input_thread_t.b_dead and b_eof

Rémi Denis-Courmont git at videolan.org
Thu Jun 4 23:10:33 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jun  5 00:05:35 2015 +0300| [eb4eb47850ace0fc260aa7cf3c664a59395ac257] | committer: Rémi Denis-Courmont

gui: remove useless checks for input_thread_t.b_dead and b_eof

The input thread sends events. There is no point in checking manually
since the input thread functions aresafe to "use" so long as the caller
has a reference to the input thread (regardless of the input thread
being dead or at EOF). Also the value of those flags can change
asynchronously (outside the input thread) so the checks were racy.

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

 modules/gui/ncurses.c             |    2 +-
 modules/gui/qt4/input_manager.hpp |    7 +------
 modules/notify/notify.c           |    4 ----
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index a91b289..4b3f88b 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1064,7 +1064,7 @@ static int DrawStatus(intf_thread_t *intf, input_thread_t *p_input)
     random = var_GetBool(p_playlist, "random") ? _("[Random] ") : "";
     loop   = var_GetBool(p_playlist, "loop")   ? _("[Loop]")    : "";
 
-    if (p_input && !p_input->b_dead) {
+    if (p_input) {
         vlc_value_t val;
         char *path, *uri;
 
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 97221a1..f34bd33 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -130,12 +130,7 @@ public:
     virtual ~InputManager();
 
     void delInput();
-    bool hasInput()
-    {
-        return p_input /* We have an input */
-            && !p_input->b_dead /* not dead yet, */
-            && !p_input->b_eof  /* not EOF either */;
-    }
+    bool hasInput() const { return p_input != NULL; }
 
     int playingStatus();
     bool hasAudio();
diff --git a/modules/notify/notify.c b/modules/notify/notify.c
index f4d99db..7a27bcf 100644
--- a/modules/notify/notify.c
+++ b/modules/notify/notify.c
@@ -170,10 +170,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     if( !p_input )
         return VLC_SUCCESS;
 
-    if( p_input->b_dead )
-        /* Not playing anything ... */
-        return VLC_SUCCESS;
-
     /* Playing something ... */
     input_item_t *p_input_item = input_GetItem( p_input );
     psz_title = input_item_GetTitleFbName( p_input_item );



More information about the vlc-commits mailing list