[vlc-commits] chromecast: refactor setPauseState

Thomas Guillem git at videolan.org
Wed Feb 7 23:45:41 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  7 09:55:57 2018 +0100| [cf7d315a61d1955296965ff7f8fa16987ebb22b6] | committer: Jean-Baptiste Kempf

chromecast: refactor setPauseState

(cherry picked from commit 87e69a5d20e5e68c710caadac7ab2dd2e39e6502)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_out/chromecast/chromecast_ctrl.cpp | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 83faa09d51..70ed8bdc70 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -921,22 +921,15 @@ void intf_sys_t::setOnSeekDoneCb(on_seek_done_itf on_seek_done, void *on_seek_do
 
 void intf_sys_t::setPauseState(bool paused)
 {
-    msg_Dbg( m_module, "%s state", paused ? "paused" : "playing" );
     vlc_mutex_locker locker( &m_lock );
+    if ( m_mediaSessionId == 0 )
+        return;
+
+    msg_Dbg( m_module, "%s state", paused ? "paused" : "playing" );
     if ( !paused )
-    {
-        if ( m_mediaSessionId != 0 )
-        {
-            m_communication.msgPlayerPlay( m_appTransportId, m_mediaSessionId );
-        }
-    }
-    else
-    {
-        if ( m_mediaSessionId != 0 && m_state != Paused )
-        {
-            m_communication.msgPlayerPause( m_appTransportId, m_mediaSessionId );
-        }
-    }
+        m_communication.msgPlayerPlay( m_appTransportId, m_mediaSessionId );
+    else if ( m_state != Paused )
+        m_communication.msgPlayerPause( m_appTransportId, m_mediaSessionId );
 }
 
 bool intf_sys_t::isFinishedPlaying()



More information about the vlc-commits mailing list