vlc/vlc-3.0 | branch: master | Thomas Guillem <tho...@gllm.fr> | Mon Feb 12 
14:00:01 2018 +0100| [31f9e13d7b7bac53bdb33d51eb5a91418e4b97d3] | committer: 
Thomas Guillem

chromecast: create interrupt context from intf_sys_t

Since it's needed only by this class

(cherry picked from commit 3441755975bcb29ff732c4bb38c4ffa5a9e5437f)
Signed-off-by: Thomas Guillem <tho...@gllm.fr>

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

 modules/stream_out/chromecast/cast.cpp            | 10 +---------
 modules/stream_out/chromecast/chromecast.h        |  2 +-
 modules/stream_out/chromecast/chromecast_ctrl.cpp |  8 ++++++--
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp 
b/modules/stream_out/chromecast/cast.cpp
index 5a5b122785..634752feeb 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -1156,10 +1156,6 @@ static int Open(vlc_object_t *p_this)
     int i_device_port;
     std::stringstream ss;
 
-    vlc_interrupt_t *p_interrupt = vlc_interrupt_create();
-    if (unlikely(p_interrupt == NULL))
-        goto error;
-
     config_ChainParse(p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, 
p_stream->p_cfg);
 
     psz_ip = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "ip");
@@ -1183,7 +1179,7 @@ static int Open(vlc_object_t *p_this)
     try
     {
         p_intf = new intf_sys_t( p_this, i_local_server_port, psz_ip, 
i_device_port,
-                                 p_interrupt, httpd_host );
+                                 httpd_host );
     }
     catch (const std::runtime_error& err )
     {
@@ -1196,8 +1192,6 @@ static int Open(vlc_object_t *p_this)
         goto error;
     }
 
-    p_interrupt = NULL;
-
     psz_mux = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mux");
     if (psz_mux == NULL)
     {
@@ -1249,8 +1243,6 @@ static int Open(vlc_object_t *p_this)
     return VLC_SUCCESS;
 
 error:
-    if (p_interrupt)
-        vlc_interrupt_destroy(p_interrupt);
     delete p_intf;
     if (httpd_host)
         httpd_HostDelete(httpd_host);
diff --git a/modules/stream_out/chromecast/chromecast.h 
b/modules/stream_out/chromecast/chromecast.h
index e07ec18843..570486fcc0 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -160,7 +160,7 @@ struct intf_sys_t
         Stop,
     };
     intf_sys_t(vlc_object_t * const p_this, int local_port, std::string 
device_addr,
-               int device_port, vlc_interrupt_t *, httpd_host_t *);
+               int device_port, httpd_host_t *);
     ~intf_sys_t();
 
     bool isFinishedPlaying();
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp 
b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 4eb30e345b..3b9107566f 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -87,7 +87,7 @@ static const char* StateToStr( States s )
  * intf_sys_t: class definition
  *****************************************************************************/
 intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string 
device_addr,
-                       int device_port, vlc_interrupt_t *p_interrupt, 
httpd_host_t *httpd_host)
+                       int device_port, httpd_host_t *httpd_host)
  : m_module(p_this)
  , m_streaming_port(port)
  , m_mediaSessionId( 0 )
@@ -103,7 +103,6 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int 
port, std::string device
  , m_eof( false )
  , m_pace( false )
  , m_meta( NULL )
- , m_ctl_thread_interrupt(p_interrupt)
  , m_httpd_host(httpd_host)
  , m_httpd_file(NULL)
  , m_art_url(NULL)
@@ -113,6 +112,10 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int 
port, std::string device
  , m_length( VLC_TS_INVALID )
  , m_pingRetriesLeft( PING_WAIT_RETRIES )
 {
+    m_ctl_thread_interrupt = vlc_interrupt_create();
+    if( unlikely(m_ctl_thread_interrupt == NULL) )
+        throw std::runtime_error( "error creating interrupt context" );
+
     vlc_mutex_init(&m_lock);
     vlc_cond_init( &m_stateChangedCond );
     vlc_cond_init( &m_pace_cond );
@@ -139,6 +142,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int 
port, std::string device
     if (vlc_clone(&m_chromecastThread, ChromecastThread, this,
                   VLC_THREAD_PRIORITY_LOW))
     {
+        vlc_interrupt_destroy( m_ctl_thread_interrupt );
         vlc_cond_destroy( &m_stateChangedCond );
         vlc_cond_destroy( &m_pace_cond );
         var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, 
NULL );

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to