[vlc-commits] chromecast: move sout destruction in a method

Thomas Guillem git at videolan.org
Thu Feb 1 11:26:23 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 30 10:39:24 2018 +0100| [cda940cf5e76cd2839774246dfda4f6fcb811133] | committer: Thomas Guillem

chromecast: move sout destruction in a method

(cherry picked from commit 796d9765f7dba276c19abe0726c6b6f52a182ce3)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/stream_out/chromecast/cast.cpp | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index d97d3926d7..db8ef30ce1 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -70,6 +70,7 @@ struct sout_stream_sys_t
                          const audio_format_t* p_fmt ) const;
     bool startSoutChain(sout_stream_t* p_stream,
                         const std::vector<sout_stream_id_sys_t*> &new_streams);
+    void stopSoutChain(sout_stream_t* p_stream);
 
     sout_stream_t     *p_out;
     std::string        sout;
@@ -336,8 +337,7 @@ static void DelInternal(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     if ( p_sys->out_streams.empty() )
     {
         p_sys->p_intf->requestPlayerStop();
-        sout_StreamChainDelete( p_sys->p_out, NULL );
-        p_sys->p_out = NULL;
+        p_sys->stopSoutChain(p_stream);
         p_sys->sout = "";
         p_sys->transcode_attempt_idx = 0;
     }
@@ -395,18 +395,30 @@ bool sout_stream_sys_t::canDecodeAudio( sout_stream_t *p_stream,
            i_codec == VLC_CODEC_MP3;
 }
 
-bool sout_stream_sys_t::startSoutChain(sout_stream_t *p_stream,
-                                       const std::vector<sout_stream_id_sys_t*> &new_streams)
+void sout_stream_sys_t::stopSoutChain(sout_stream_t *p_stream)
 {
+    (void) p_stream;
+
     if ( unlikely( p_out != NULL ) )
     {
         for ( size_t i = 0; i < out_streams.size(); i++ )
         {
             if ( out_streams[i]->p_sub_id != NULL )
+            {
                 sout_StreamIdDel( p_out, out_streams[i]->p_sub_id );
+                out_streams[i]->p_sub_id = NULL;
+            }
         }
+        out_streams.clear();
         sout_StreamChainDelete( p_out, NULL );
+        p_out = NULL;
     }
+}
+
+bool sout_stream_sys_t::startSoutChain(sout_stream_t *p_stream,
+                                       const std::vector<sout_stream_id_sys_t*> &new_streams)
+{
+    stopSoutChain( p_stream );
 
     msg_Dbg( p_stream, "Creating chain %s", sout.c_str() );
     cc_has_input = false;



More information about the vlc-commits mailing list