vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauz...@gmail.com> | Thu Jan 5 16:06:54 2012 +0100| [8d6ddd7000a8df9c32bd99c4ef1d4193e55229bf] | committer: Jean-Baptiste Kempf
dash: Don't crash when a segment can't be accessed. Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> (cherry picked from commit 88dc675a805600c9d3464d3af0008afaee18ef3f) Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=8d6ddd7000a8df9c32bd99c4ef1d4193e55229bf --- modules/stream_filter/dash/http/HTTPConnection.cpp | 6 +++--- .../dash/http/HTTPConnectionManager.cpp | 12 ++++++++---- .../dash/http/HTTPConnectionManager.h | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/stream_filter/dash/http/HTTPConnection.cpp b/modules/stream_filter/dash/http/HTTPConnection.cpp index d42aa43..493c105 100644 --- a/modules/stream_filter/dash/http/HTTPConnection.cpp +++ b/modules/stream_filter/dash/http/HTTPConnection.cpp @@ -66,11 +66,11 @@ void HTTPConnection::parseURL () this->request = "GET " + this->path + " HTTP/1.1\r\n" + "Host: " + this->hostname + "\r\nConnection: close\r\n\r\n"; } -bool HTTPConnection::init () +bool HTTPConnection::init() { - this->urlStream = stream_UrlNew(this->stream, this->url.c_str()); + this->urlStream = stream_UrlNew( this->stream, this->url.c_str() ); - if(!this->urlStream) + if( this->urlStream == NULL ) return false; return true; diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp index 0084f7d..d1cf529 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp @@ -127,7 +127,8 @@ int HTTPConnectionManager::read (Chunk *chun this->bytesReadChunk = 0; this->timeSecChunk = 0; - this->initConnection(chunk); + if ( this->initConnection(chunk) == NULL ) + return -1; return this->read(chunk, p_buffer, len); } } @@ -136,13 +137,16 @@ int HTTPConnectionManager::peek (Chunk *chun if(this->chunkMap.find(chunk) != this->chunkMap.end()) return this->chunkMap[chunk]->peek(pp_peek, i_peek); - this->initConnection(chunk); + if ( this->initConnection(chunk) == NULL ) + return -1; return this->peek(chunk, pp_peek, i_peek); } -HTTPConnection* HTTPConnectionManager::initConnection (Chunk *chunk) + +IHTTPConnection* HTTPConnectionManager::initConnection(Chunk *chunk) { HTTPConnection *con = new HTTPConnection(chunk->getUrl(), this->stream); - con->init(); + if ( con->init() == false ) + return NULL; this->connections.push_back(con); this->chunkMap[chunk] = con; this->chunkCount++; diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h index 56ba8f6..c82c937 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.h +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h @@ -69,8 +69,8 @@ namespace dash stream_t *stream; int chunkCount; - bool closeConnection (Chunk *chunk); - HTTPConnection* initConnection (Chunk *chunk); + bool closeConnection( Chunk *chunk ); + IHTTPConnection* initConnection( Chunk *chunk ); }; } _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org http://mailman.videolan.org/listinfo/vlc-commits