[vlc-commits] demux: adaptive: merge available/canreuse methods

Francois Cartegnie git at videolan.org
Thu Feb 25 23:00:45 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 25 14:52:57 2016 +0100| [4b6748fecb9b40d96e70b44c35b22dede74b5863] | committer: Francois Cartegnie

demux: adaptive: merge available/canreuse methods

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

 modules/demux/adaptive/http/HTTPConnection.cpp        |    8 ++------
 modules/demux/adaptive/http/HTTPConnection.hpp        |    1 -
 modules/demux/adaptive/http/HTTPConnectionManager.cpp |    2 +-
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index f9dd3fa..5f95c9a 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -50,11 +50,6 @@ bool AbstractConnection::prepare(const ConnectionParams &params_)
     return true;
 }
 
-bool AbstractConnection::isAvailable() const
-{
-    return available;
-}
-
 size_t AbstractConnection::getContentLength() const
 {
     return contentLength;
@@ -78,7 +73,8 @@ HTTPConnection::~HTTPConnection()
 
 bool HTTPConnection::canReuse(const ConnectionParams &params_) const
 {
-    return ( params.getHostname() == params_.getHostname() &&
+    return ( available &&
+             params.getHostname() == params_.getHostname() &&
              params.getScheme() == params_.getScheme() &&
              params.getPort() == params_.getPort() );
 }
diff --git a/modules/demux/adaptive/http/HTTPConnection.hpp b/modules/demux/adaptive/http/HTTPConnection.hpp
index 33683f2..d6cffc3 100644
--- a/modules/demux/adaptive/http/HTTPConnection.hpp
+++ b/modules/demux/adaptive/http/HTTPConnection.hpp
@@ -53,7 +53,6 @@ namespace adaptive
                 virtual int     query       (const std::string& path, const BytesRange & = BytesRange()) = 0;
                 virtual ssize_t read        (void *p_buffer, size_t len) = 0;
 
-                bool            isAvailable () const;
                 virtual size_t  getContentLength() const;
                 virtual void    setUsed( bool ) = 0;
 
diff --git a/modules/demux/adaptive/http/HTTPConnectionManager.cpp b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
index 07b4a08..7287f38 100644
--- a/modules/demux/adaptive/http/HTTPConnectionManager.cpp
+++ b/modules/demux/adaptive/http/HTTPConnectionManager.cpp
@@ -75,7 +75,7 @@ AbstractConnection * HTTPConnectionManager::reuseConnection(ConnectionParams &pa
     for(it = connectionPool.begin(); it != connectionPool.end(); ++it)
     {
         AbstractConnection *conn = *it;
-        if(conn->isAvailable() && conn->canReuse(params))
+        if(conn->canReuse(params))
             return conn;
     }
     return NULL;



More information about the vlc-commits mailing list