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

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


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 16 17:25:11 2019 +0200| [00703d9242553b51823b94d7400db43a2db465bc] | committer: Francois Cartegnie

demux: adaptive: use shared connmanager for helper

(cherry picked from commit 66c50b8fc6bbfc829b4b748f2342bc3457a4d96b)

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

 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              | 8 ++++----
 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, 15 insertions(+), 27 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 c14f2fcb94..ac66411b8c 100644
--- a/modules/demux/adaptive/tools/Retrieve.cpp
+++ b/modules/demux/adaptive/tools/Retrieve.cpp
@@ -27,18 +27,18 @@
 #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);
-    } catch (int) {
+        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 c64d8bb192..352475af76 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -106,8 +106,7 @@ bool DASHManager::updatePlaylist()
         url.append("://");
         url.append(p_demux->psz_location);
 
-        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 0e78e2e85d..e588a969bb 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 4272bf2c90..1c50ed1efb 100644
--- a/modules/demux/smooth/SmoothManager.cpp
+++ b/modules/demux/smooth/SmoothManager.cpp
@@ -59,8 +59,7 @@ Manifest * SmoothManager::fetchManifest()
     playlisturl.append("://");
     playlisturl.append(p_demux->psz_location);
 
-    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