[vlc-commits] playlist: use playlist_TogglePause() directly, fix minor races

Rémi Denis-Courmont git at videolan.org
Mon Dec 15 18:25:19 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 15 19:21:58 2014 +0200| [a437fe543c74f75ccaa9be8afce252449e7afa66] | committer: Rémi Denis-Courmont

playlist: use playlist_TogglePause() directly, fix minor races

This function already starts playback if stopped (and as far as I know
it always has).

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

 modules/control/dbus/dbus_player.c |   11 +----------
 modules/control/hotkeys.c          |    4 +---
 modules/gui/qt4/input_manager.cpp  |    6 +-----
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 82e18cd..b01c9d9 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -229,16 +229,7 @@ DBUS_METHOD( Pause )
 DBUS_METHOD( PlayPause )
 {
     REPLY_INIT;
-    input_thread_t *p_input = pl_CurrentInput( p_this );
-
-    if( p_input && var_GetInteger(p_input, "state") == PLAYING_S )
-        playlist_TogglePause( PL );
-    else
-        playlist_Play( PL );
-
-    if( p_input )
-        vlc_object_release( p_input );
-
+    playlist_TogglePause( PL );
     REPLY_SEND;
 }
 
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 99b364c..77843a3 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -349,10 +349,8 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
                 int state = var_GetInteger( p_input, "state" );
                 DisplayIcon( p_vout, state != PAUSE_S ? OSD_PAUSE_ICON : OSD_PLAY_ICON );
-                playlist_TogglePause( p_playlist );
             }
-            else
-                playlist_Play( p_playlist );
+            playlist_TogglePause( p_playlist );
             break;
 
         case ACTIONID_PLAY:
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 392a089..4c0df74 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -1119,11 +1119,7 @@ void MainInputManager::prevOrReset()
 
 void MainInputManager::togglePlayPause()
 {
-    /* No input, play */
-    if( !p_input )
-        playlist_Play( THEPL );
-    else
-        playlist_TogglePause( THEPL );
+    playlist_TogglePause( THEPL );
 }
 
 void MainInputManager::play()



More information about the vlc-commits mailing list