[vlc-devel] [PATCH 1/6] sout: chromecast: remove flawed sout-test in Open

Filip Roséen filip at atch.se
Mon Jul 23 19:56:57 CEST 2018


The relevant code suffers from some immediate flaws, with no real
gain:

  1. The implicit http-bind from within sout_StreamChainNew has a high
     chance of colliding with other things in vlc (most notably a
     web interface).

  2. It does not bind to the same httpd URI as is later used in the
     module, causing the check to signal false security in terms of
     usability.

  3. As the sout is created only to immediately be shut down, other
     attempts (not made within the module) to create a relevant sout
     will race with this "check".

     Just because we succeed in Open does not mean that we will
     succeed later on, nor does failure guarantee further failed
     attempts.

  4. There is no reason for us to check if a muxer is available at
     this stage as it:

        a) Does not send any data down the pipe, meaning that we might
           fail anyway when we actually get started due to, as an
           example, codec issues.

        b) Does not match what might actually be used (avformat/webm
           or avformat/mkv is selected further into the
           implementation)

        c) Is the wrong way of checking things. If we want to make
           sure that an sout is created before some other work is
           done, we should create an sout which we then use, _before_,
           other work is done.

refs: #20380
---
 modules/stream_out/chromecast/cast.cpp | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 407d1e2e23..c140d952af 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -1499,7 +1499,6 @@ static int Open(vlc_object_t *p_this)
     sout_stream_sys_t *p_sys = NULL;
     intf_sys_t *p_intf = NULL;
     char *psz_ip = NULL;
-    sout_stream_t *p_sout = NULL;
     httpd_host_t *httpd_host = NULL;
     bool b_supports_video = true;
     int i_local_server_port;
@@ -1542,15 +1541,6 @@ static int Open(vlc_object_t *p_this)
         goto error;
     }
 
-    /* check if we can open the proper sout */
-    ss << "http{mux=" << DEFAULT_MUXER << "}";
-    p_sout = sout_StreamChainNew( p_stream->p_sout, ss.str().c_str(), NULL, NULL);
-    if (p_sout == NULL) {
-        msg_Dbg(p_stream, "could not create sout chain:%s", ss.str().c_str());
-        goto error;
-    }
-    sout_StreamChainDelete( p_sout, NULL );
-
     b_supports_video = var_GetBool(p_stream, SOUT_CFG_PREFIX "video");
 
     try
-- 
2.18.0


More information about the vlc-devel mailing list