[vlc-commits] chromecast: do the disconnect in the recv/send thread

Steve Lhomme git at videolan.org
Tue May 10 23:43:37 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Mon May  9 22:08:47 2016 +0200| [19c661f019646af47049c070592952edc6b1df4e] | committer: Jean-Baptiste Kempf

chromecast: do the disconnect in the recv/send thread

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index b6d7917..28fe8cf 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -142,8 +142,6 @@ intf_sys_t::~intf_sys_t()
 
     vlc_join(chromecastThread, NULL);
 
-    disconnectChromecast();
-
     vlc_interrupt_destroy( p_ctl_thread_interrupt );
 
     vlc_cond_destroy(&loadCommandCond);
@@ -831,9 +829,8 @@ void* intf_sys_t::ChromecastThread(void* p_data)
     if (p_sys->i_sock_fd < 0)
     {
         msg_Err( p_sys->p_module, "Could not connect the Chromecast" );
-        vlc_mutex_lock(&p_sys->lock);
+        vlc_mutex_locker locker(&p_sys->lock);
         p_sys->setConnectionStatus(CHROMECAST_CONNECTION_DEAD);
-        vlc_mutex_unlock(&p_sys->lock);
         return NULL;
     }
 
@@ -841,9 +838,8 @@ void* intf_sys_t::ChromecastThread(void* p_data)
     if (net_GetSockAddress(p_sys->i_sock_fd, psz_localIP, NULL))
     {
         msg_Err( p_sys->p_module, "Cannot get local IP address" );
-        vlc_mutex_lock(&p_sys->lock);
-        p_sys->setConnectionStatus(CHROMECAST_CONNECTION_DEAD);
-        vlc_mutex_unlock(&p_sys->lock);
+        vlc_mutex_locker locker(&p_sys->lock);
+        p_sys->disconnectChromecast();
         return NULL;
     }
 
@@ -858,6 +854,8 @@ void* intf_sys_t::ChromecastThread(void* p_data)
 
     while ( !vlc_killed() && p_sys->handleMessages() );
 
+    p_sys->disconnectChromecast();
+
     return NULL;
 }
 



More information about the vlc-commits mailing list