chromecast: autoclean in case of failure
authorThomas Guillem <thomas@gllm.fr>
Thu, 1 Feb 2018 12:37:27 +0000 (13:37 +0100)
committerThomas Guillem <thomas@gllm.fr>
Thu, 1 Feb 2018 12:45:42 +0000 (13:45 +0100)
A method should clean itself in case of failure.

modules/stream_out/chromecast/cast.cpp

index 67f1c33..2bcce86 100644 (file)
@@ -685,7 +685,14 @@ bool sout_stream_sys_t::startSoutChain(sout_stream_t *p_stream,
         else
             ++it;
     }
-    return out_streams.empty() == false;
+
+    if (out_streams.empty())
+    {
+        stopSoutChain( p_stream );
+        access_out_live.clear();
+        return false;
+    }
+    return true;
 }
 
 bool sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
@@ -888,13 +895,8 @@ bool sout_stream_sys_t::UpdateOutput( sout_stream_t *p_stream )
           << ",access=chromecast-http";
 
     if ( !startSoutChain( p_stream, new_streams, ssout.str() ) )
-    {
         p_intf->requestPlayerStop();
 
-        sout_StreamChainDelete( p_out, NULL );
-        access_out_live.clear();
-        p_out = NULL;
-    }
     return true;
 }