[vlc-commits] demux: adaptive: use shared connmanager for helper

Francois Cartegnie git at videolan.org
Wed Oct 16 20:21:10 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 16 17:25:11 2019 +0200| [66c50b8fc6bbfc829b4b748f2342bc3457a4d96b] | committer: Francois Cartegnie

demux: adaptive: use shared connmanager for helper

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

 modules/demux/adaptive/encryption/CommonEncryption.cpp | 2 +-
 modules/demux/adaptive/encryption/Keyring.cpp          | 6 ++----
 modules/demux/adaptive/encryption/Keyring.hpp          | 7 ++-----
 modules/demux/adaptive/tools/Retrieve.cpp              | 6 +++---
 modules/demux/adaptive/tools/Retrieve.hpp              | 7 ++-----
 modules/demux/dash/DASHManager.cpp                     | 3 +--
 modules/demux/hls/playlist/Parser.cpp                  | 6 ++----
 modules/demux/smooth/SmoothManager.cpp                 | 3 +--
 8 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/modules/demux/adaptive/encryption/CommonEncryption.cpp b/modules/demux/adaptive/encryption/CommonEncryption.cpp
index a5a021d31a..adcac4a34d 100644
--- a/modules/demux/adaptive/encryption/CommonEncryption.cpp
+++ b/modules/demux/adaptive/encryption/CommonEncryption.cpp
@@ -74,7 +74,7 @@ bool CommonEncryptionSession::start(SharedResources *res, const CommonEncryption
         if(key.empty())
         {
             if(!encryption.uri.empty())
-                key = res->getKeyring()->getKey(res->getAuthStorage(), encryption.uri);
+                key = res->getKeyring()->getKey(res, encryption.uri);
             if(key.size() != 16)
                 return false;
         }
diff --git a/modules/demux/adaptive/encryption/Keyring.cpp b/modules/demux/adaptive/encryption/Keyring.cpp
index baa630a1bc..bd34f3c7ed 100644
--- a/modules/demux/adaptive/encryption/Keyring.cpp
+++ b/modules/demux/adaptive/encryption/Keyring.cpp
@@ -23,7 +23,6 @@
 #endif
 
 #include "Keyring.hpp"
-#include "../http/AuthStorage.hpp"
 #include "../tools/Retrieve.hpp"
 
 #include <vlc_block.h>
@@ -31,7 +30,6 @@
 #include <algorithm>
 
 using namespace adaptive::encryption;
-using namespace adaptive::http;
 
 Keyring::Keyring(vlc_object_t *obj_)
 {
@@ -44,7 +42,7 @@ Keyring::~Keyring()
     vlc_mutex_destroy(&lock);
 }
 
-KeyringKey Keyring::getKey(AuthStorage *auth, const std::string &uri)
+KeyringKey Keyring::getKey(SharedResources *resources, const std::string &uri)
 {
     KeyringKey key;
 
@@ -54,7 +52,7 @@ KeyringKey Keyring::getKey(AuthStorage *auth, const std::string &uri)
     {
         /* Pretty bad inside the lock */
         msg_Dbg(obj, "Retrieving AES key %s", uri.c_str());
-        block_t *p_block = Retrieve::HTTP(obj, auth, uri);
+        block_t *p_block = Retrieve::HTTP(resources, uri);
         if(p_block)
         {
             if(p_block->i_buffer == 16)
diff --git a/modules/demux/adaptive/encryption/Keyring.hpp b/modules/demux/adaptive/encryption/Keyring.hpp
index 192cd1d9a7..d3e7905c51 100644
--- a/modules/demux/adaptive/encryption/Keyring.hpp
+++ b/modules/demux/adaptive/encryption/Keyring.hpp
@@ -29,10 +29,7 @@
 
 namespace adaptive
 {
-    namespace http
-    {
-        class AuthStorage;
-    }
+    class SharedResources;
 
     namespace encryption
     {
@@ -43,7 +40,7 @@ namespace adaptive
             public:
                 Keyring(vlc_object_t *);
                 ~Keyring();
-                KeyringKey getKey(http::AuthStorage *, const std::string &);
+                KeyringKey getKey(SharedResources *, const std::string &);
 
             private:
                 static const int MAX_KEYS = 50;
diff --git a/modules/demux/adaptive/tools/Retrieve.cpp b/modules/demux/adaptive/tools/Retrieve.cpp
index a6171e5507..ac66411b8c 100644
--- a/modules/demux/adaptive/tools/Retrieve.cpp
+++ b/modules/demux/adaptive/tools/Retrieve.cpp
@@ -27,17 +27,17 @@
 #include "../http/HTTPConnectionManager.h"
 #include "../http/HTTPConnection.hpp"
 #include "../http/Chunk.h"
+#include "../SharedResources.hpp"
 
 using namespace adaptive;
 using namespace adaptive::http;
 
-block_t * Retrieve::HTTP(vlc_object_t *obj, AuthStorage *auth, const std::string &uri)
+block_t * Retrieve::HTTP(SharedResources *resources, const std::string &uri)
 {
-    HTTPConnectionManager connManager(obj, auth);
     HTTPChunk *datachunk;
     try
     {
-        datachunk = new HTTPChunk(uri, &connManager, ID(), true);
+        datachunk = new HTTPChunk(uri, resources->getConnManager(), ID(), true);
     } catch (...) {
         return NULL;
     }
diff --git a/modules/demux/adaptive/tools/Retrieve.hpp b/modules/demux/adaptive/tools/Retrieve.hpp
index 55128c8f60..7b19430052 100644
--- a/modules/demux/adaptive/tools/Retrieve.hpp
+++ b/modules/demux/adaptive/tools/Retrieve.hpp
@@ -25,15 +25,12 @@
 
 namespace adaptive
 {
-    namespace http
-    {
-        class AuthStorage;
-    }
+    class SharedResources;
 
     class Retrieve
     {
         public:
-            static block_t * HTTP(vlc_object_t *, http::AuthStorage *, const std::string &uri);
+            static block_t * HTTP(SharedResources *, const std::string &uri);
     };
 }
 
diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index 33b403eeea..5c200f3e49 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -103,8 +103,7 @@ bool DASHManager::updatePlaylist()
     {
         std::string url(p_demux->psz_url);
 
-        block_t *p_block = Retrieve::HTTP(VLC_OBJECT(p_demux),
-                                          resources->getAuthStorage(), url);
+        block_t *p_block = Retrieve::HTTP(resources, url);
         if(!p_block)
             return false;
 
diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index fddcc9931a..2c4d645007 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -157,8 +157,7 @@ void M3U8Parser::createAndFillRepresentation(vlc_object_t *p_obj, BaseAdaptation
 
 bool M3U8Parser::appendSegmentsFromPlaylistURI(vlc_object_t *p_obj, Representation *rep)
 {
-    block_t *p_block = Retrieve::HTTP(p_obj, resources->getAuthStorage(),
-                                      rep->getPlaylistUrl().toString());
+    block_t *p_block = Retrieve::HTTP(resources, rep->getPlaylistUrl().toString());
     if(p_block)
     {
         stream_t *substream = vlc_stream_MemoryNew(p_obj, p_block->p_buffer, p_block->i_buffer, true);
@@ -412,8 +411,7 @@ M3U8 * M3U8Parser::parse(vlc_object_t *p_object, stream_t *p_stream, const std::
                                 playlist->getUrlSegment(), sessionEncryption) &&
                !sessionEncryption.uri.empty())
             {
-                resources->getKeyring()->getKey(resources->getAuthStorage(),
-                                                sessionEncryption.uri);
+                resources->getKeyring()->getKey(resources, sessionEncryption.uri);
             }
         }
 
diff --git a/modules/demux/smooth/SmoothManager.cpp b/modules/demux/smooth/SmoothManager.cpp
index f1dc476bf7..5f40ef4e3d 100644
--- a/modules/demux/smooth/SmoothManager.cpp
+++ b/modules/demux/smooth/SmoothManager.cpp
@@ -57,8 +57,7 @@ Manifest * SmoothManager::fetchManifest()
 {
     std::string playlisturl(p_demux->psz_url);
 
-    block_t *p_block = Retrieve::HTTP(VLC_OBJECT(p_demux),
-                                      resources->getAuthStorage(), playlisturl);
+    block_t *p_block = Retrieve::HTTP(resources, playlisturl);
     if(!p_block)
         return NULL;
 



More information about the vlc-commits mailing list