[vlc-commits] demux: adaptive: set playlist local flag on connmanager

Francois Cartegnie git at videolan.org
Mon Mar 30 16:16:23 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 16 19:10:10 2019 +0200| [94cebc8c7d4b759a7231b2d9d720eb5a601497cc] | committer: Francois Cartegnie

demux: adaptive: set playlist local flag on connmanager

(cherry picked from commit d40a43173dd0c03899782376ce6fe02ca99bc322)

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

 modules/demux/adaptive/SharedResources.cpp |  7 +++++--
 modules/demux/adaptive/SharedResources.hpp |  2 +-
 modules/demux/adaptive/adaptive.cpp        | 16 +++++++++++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptive/SharedResources.cpp b/modules/demux/adaptive/SharedResources.cpp
index f09c088569..05c7a9288f 100644
--- a/modules/demux/adaptive/SharedResources.cpp
+++ b/modules/demux/adaptive/SharedResources.cpp
@@ -30,11 +30,14 @@
 
 using namespace adaptive;
 
-SharedResources::SharedResources(vlc_object_t *obj)
+SharedResources::SharedResources(vlc_object_t *obj, bool local)
 {
     authStorage = new AuthStorage(obj);
     encryptionKeyring = new Keyring(obj);
-    connManager = new HTTPConnectionManager(obj, authStorage);
+    HTTPConnectionManager *m = new HTTPConnectionManager(obj, authStorage);
+    if(m && local)
+        m->setLocalConnectionsAllowed();
+    connManager = m;
 }
 
 SharedResources::~SharedResources()
diff --git a/modules/demux/adaptive/SharedResources.hpp b/modules/demux/adaptive/SharedResources.hpp
index 5eff6eec06..0ef5256da5 100644
--- a/modules/demux/adaptive/SharedResources.hpp
+++ b/modules/demux/adaptive/SharedResources.hpp
@@ -41,7 +41,7 @@ namespace adaptive
     class SharedResources
     {
         public:
-            SharedResources(vlc_object_t *);
+            SharedResources(vlc_object_t *, bool = false);
             ~SharedResources();
             AuthStorage *getAuthStorage();
             Keyring     *getKeyring();
diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index 4704b7e687..c46acc9be3 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -257,6 +257,13 @@ static void Close(vlc_object_t *p_obj)
 /*****************************************************************************
  *
  *****************************************************************************/
+static bool IsLocalResource(const std::string & url)
+{
+    ConnectionParams params(url);
+    return params.isLocal();
+}
+
+
 static PlaylistManager * HandleDash(demux_t *p_demux, DOMParser &xmlParser,
                                     const std::string & playlisturl,
                                     AbstractAdaptationLogic::LogicType logic)
@@ -275,7 +282,8 @@ static PlaylistManager * HandleDash(demux_t *p_demux, DOMParser &xmlParser,
         return NULL;
     }
 
-    SharedResources *resources = new (std::nothrow) SharedResources(VLC_OBJECT(p_demux));
+    SharedResources *resources = new (std::nothrow) SharedResources(VLC_OBJECT(p_demux),
+                                                                    IsLocalResource(playlisturl));
     DASHStreamFactory *factory = new (std::nothrow) DASHStreamFactory;
     DASHManager *manager = NULL;
     if(!resources || !factory ||
@@ -307,7 +315,8 @@ static PlaylistManager * HandleSmooth(demux_t *p_demux, DOMParser &xmlParser,
         return NULL;
     }
 
-    SharedResources *resources = new (std::nothrow) SharedResources(VLC_OBJECT(p_demux));
+    SharedResources *resources = new (std::nothrow) SharedResources(VLC_OBJECT(p_demux),
+                                                                    IsLocalResource(playlisturl));
     SmoothStreamFactory *factory = new (std::nothrow) SmoothStreamFactory;
     SmoothManager *manager = NULL;
     if(!resources || !factory ||
@@ -325,7 +334,8 @@ static PlaylistManager * HandleHLS(demux_t *p_demux,
                                    const std::string & playlisturl,
                                    AbstractAdaptationLogic::LogicType logic)
 {
-    SharedResources *resources = new SharedResources(VLC_OBJECT(p_demux));
+    SharedResources *resources = new SharedResources(VLC_OBJECT(p_demux),
+                                                     IsLocalResource(playlisturl));
     if(!resources)
         return NULL;
 



More information about the vlc-commits mailing list