[vlc-commits] chromecast: Don't call setHasInput( false )

Hugo Beauzée-Luyssen git at videolan.org
Tue Feb 21 14:00:58 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 20 15:13:29 2017 +0100| [71f6fc8ffe9efeb5b723c474c83d64b94a5562e6] | committer: Hugo Beauzée-Luyssen

chromecast: Don't call setHasInput( false )

This is a no-op.

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

 modules/stream_out/chromecast/cast.cpp            |  2 +-
 modules/stream_out/chromecast/chromecast.h        |  2 +-
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 36 +++++++++--------------
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index fef1bc4..e3de881 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -333,7 +333,7 @@ int sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
         if ( !streams.empty() )
         {
             /* tell the chromecast to load the content */
-            p_intf->setHasInput( true, mime );
+            p_intf->setHasInput( mime );
         }
         else
         {
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 3a69c40..a347f91 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -142,7 +142,7 @@ struct intf_sys_t
 
     bool isFinishedPlaying();
 
-    void setHasInput( bool has_input, const std::string mime_type = "");
+    void setHasInput(const std::string mime_type = "");
 
     void requestPlayerSeek(mtime_t pos);
     void requestPlayerStop();
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index cb2a317..c3f82fd 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -121,8 +121,6 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
 
 intf_sys_t::~intf_sys_t()
 {
-    setHasInput( false );
-
     var_Destroy( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME );
 
     switch ( m_state )
@@ -160,31 +158,27 @@ intf_sys_t::~intf_sys_t()
     vlc_mutex_destroy(&m_lock);
 }
 
-void intf_sys_t::setHasInput( bool b_has_input, const std::string mime_type )
+void intf_sys_t::setHasInput( const std::string mime_type )
 {
     vlc_mutex_locker locker(&m_lock);
-    msg_Dbg( m_module, "setHasInput %s session:%s",b_has_input ? "true":"false", m_mediaSessionId.c_str() );
+    msg_Dbg( m_module, "Loading content for session:%s", m_mediaSessionId.c_str() );
 
     this->m_mime = mime_type;
 
-    if( b_has_input )
+    mutex_cleanup_push(&m_lock);
+    waitAppStarted();
+    vlc_cleanup_pop();
+    if ( m_state == Dead )
     {
-        mutex_cleanup_push(&m_lock);
-        waitAppStarted();
-        vlc_cleanup_pop();
-
-        if ( m_state == Dead )
-        {
-            msg_Warn( m_module, "no Chromecast hook possible");
-            return;
-        }
-        // We should now be in the ready state, and therefor have a valid transportId
-        assert( m_state == Ready && m_appTransportId.empty() == false );
-        // we cannot start a new load when the last one is still processing
-        m_ts_local_start = VLC_TS_0;
-        m_communication.msgPlayerLoad( m_appTransportId, m_streaming_port, m_title, m_artwork, mime_type );
-        setState( Loading );
+        msg_Warn( m_module, "no Chromecast hook possible");
+        return;
     }
+    // We should now be in the ready state, and therefor have a valid transportId
+    assert( m_state == Ready && m_appTransportId.empty() == false );
+    // we cannot start a new load when the last one is still processing
+    m_ts_local_start = VLC_TS_0;
+    m_communication.msgPlayerLoad( m_appTransportId, m_streaming_port, m_title, m_artwork, mime_type );
+    setState( Loading );
 }
 
 /**
@@ -526,7 +520,6 @@ void intf_sys_t::processConnectionMessage( const castchannel::CastMessage& msg )
     {
         // Close message indicates an application is being closed, not the connection.
         // From this point on, we need to relaunch the media receiver app
-        setHasInput( false );
         vlc_mutex_locker locker(&m_lock);
         m_appTransportId = "";
         m_mediaSessionId = "";
@@ -611,7 +604,6 @@ void intf_sys_t::notifySendRequest()
 void intf_sys_t::requestPlayerStop()
 {
     m_requested_stop = true;
-    setHasInput(false);
     notifySendRequest();
 }
 



More information about the vlc-commits mailing list