[vlc-devel] [PATCH 7/9] dash: removed EOFException
Hugo Beauzée-Luyssen
beauze.h at gmail.com
Mon Mar 12 11:29:22 CET 2012
On Fri, Mar 9, 2012 at 7:05 PM, <Christopher at mailsrv.uni-klu.ac.at> wrote:
> From: Christopher Mueller <christopher.mueller at itec.aau.at>
>
> ---
> modules/stream_filter/dash/DASHDownloader.cpp | 8 +---
> modules/stream_filter/dash/DASHDownloader.h | 1 -
> modules/stream_filter/dash/DASHManager.cpp | 1 -
> modules/stream_filter/dash/DASHManager.h | 1 -
> modules/stream_filter/dash/Modules.am | 1 -
> .../adaptationlogic/AbstractAdaptationLogic.cpp | 1 -
> .../dash/adaptationlogic/AbstractAdaptationLogic.h | 1 -
> .../adaptationlogic/AlwaysBestAdaptationLogic.cpp | 7 +--
> .../adaptationlogic/AlwaysBestAdaptationLogic.h | 3 +-
> .../dash/adaptationlogic/IAdaptationLogic.h | 5 +-
> .../adaptationlogic/RateBasedAdaptationLogic.cpp | 9 ++--
> .../adaptationlogic/RateBasedAdaptationLogic.h | 3 +-
> .../stream_filter/dash/exceptions/EOFException.h | 42 --------------------
> 13 files changed, 13 insertions(+), 70 deletions(-)
> delete mode 100644 modules/stream_filter/dash/exceptions/EOFException.h
>
> diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp
> index 1a0b21e..0fd5c92 100644
> --- a/modules/stream_filter/dash/DASHDownloader.cpp
> +++ b/modules/stream_filter/dash/DASHDownloader.cpp
> @@ -30,7 +30,6 @@
> using namespace dash;
> using namespace dash::http;
> using namespace dash::logic;
> -using namespace dash::exception;
> using namespace dash::buffer;
>
> DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, IAdaptationLogic *adaptationLogic, BlockBuffer *buffer)
> @@ -67,11 +66,8 @@ void* DASHDownloader::download (void *thread_sys)
> {
> if(currentChunk == NULL)
> {
> - try
> - {
> - currentChunk = adaptationLogic->getNextChunk();
> - }
> - catch(EOFException &e)
> + currentChunk = adaptationLogic->getNextChunk();
> + if(currentChunk == NULL)
> {
> buffer->setEOF(true);
> }
> diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h
> index 4ab84f1..1fcdf19 100644
> --- a/modules/stream_filter/dash/DASHDownloader.h
> +++ b/modules/stream_filter/dash/DASHDownloader.h
> @@ -27,7 +27,6 @@
>
> #include "http/HTTPConnectionManager.h"
> #include "adaptationlogic/IAdaptationLogic.h"
> -#include "exceptions/EOFException.h"
> #include "buffer/BlockBuffer.h"
>
> #define BLOCKSIZE 32768
> diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp
> index a98e01a..f649015 100644
> --- a/modules/stream_filter/dash/DASHManager.cpp
> +++ b/modules/stream_filter/dash/DASHManager.cpp
> @@ -33,7 +33,6 @@ using namespace dash::xml;
> using namespace dash::logic;
> using namespace dash::mpd;
> using namespace dash::buffer;
> -using namespace dash::exception;
>
> DASHManager::DASHManager ( HTTPConnectionManager *conManager, MPD *mpd,
> IAdaptationLogic::LogicType type, stream_t *stream) :
> diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h
> index 6c9d16a..a09e98e 100644
> --- a/modules/stream_filter/dash/DASHManager.h
> +++ b/modules/stream_filter/dash/DASHManager.h
> @@ -33,7 +33,6 @@
> #include "mpd/MPDManagerFactory.h"
> #include "buffer/BlockBuffer.h"
> #include "DASHDownloader.h"
> -#include "exceptions/EOFException.h"
> #include "mpd/MPD.h"
>
> namespace dash
> diff --git a/modules/stream_filter/dash/Modules.am b/modules/stream_filter/dash/Modules.am
> index fe6d7d4..39f7277 100644
> --- a/modules/stream_filter/dash/Modules.am
> +++ b/modules/stream_filter/dash/Modules.am
> @@ -12,7 +12,6 @@ SOURCES_stream_filter_dash = \
> buffer/BlockBuffer.cpp \
> buffer/BlockBuffer.h \
> buffer/IBufferObserver.h \
> - exceptions/EOFException.h \
> http/Chunk.cpp \
> http/Chunk.h \
> http/HTTPConnection.cpp \
> diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> index dd15e87..c01af2b 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
> @@ -30,7 +30,6 @@
> using namespace dash::logic;
> using namespace dash::xml;
> using namespace dash::mpd;
> -using namespace dash::exception;
>
> AbstractAdaptationLogic::AbstractAdaptationLogic (IMPDManager *mpdManager, stream_t *stream) :
> bpsAvg (0),
> diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> index 0812cdd..4f2700b 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
> @@ -33,7 +33,6 @@
> #include "mpd/Period.h"
> #include "mpd/Representation.h"
> #include "mpd/Segment.h"
> -#include "exceptions/EOFException.h"
>
> struct stream_t;
>
> diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> index 01d7c44..053f815 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
> @@ -31,7 +31,6 @@ using namespace dash::logic;
> using namespace dash::xml;
> using namespace dash::http;
> using namespace dash::mpd;
> -using namespace dash::exception;
>
> AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic (IMPDManager *mpdManager, stream_t *stream) :
> AbstractAdaptationLogic (mpdManager, stream)
> @@ -44,13 +43,13 @@ AlwaysBestAdaptationLogic::~AlwaysBestAdaptationLogic ()
> {
> }
>
> -Chunk* AlwaysBestAdaptationLogic::getNextChunk() throw(EOFException)
> +Chunk* AlwaysBestAdaptationLogic::getNextChunk()
> {
> if(this->schedule.size() == 0)
> - throw EOFException();
> + return NULL;
>
> if(this->count == this->schedule.size())
> - throw EOFException();
> + return NULL;
>
> if ( this->count < this->schedule.size() )
> {
> diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> index 3b577f7..748a864 100644
> --- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
> @@ -31,7 +31,6 @@
> #include "mpd/IMPDManager.h"
> #include "mpd/Period.h"
> #include "mpd/Segment.h"
> -#include "exceptions/EOFException.h"
> #include "mpd/BasicCMManager.h"
> #include <vector>
>
> @@ -45,7 +44,7 @@ namespace dash
> AlwaysBestAdaptationLogic (dash::mpd::IMPDManager *mpdManager, stream_t *stream);
> virtual ~AlwaysBestAdaptationLogic ();
>
> - dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
> + dash::http::Chunk* getNextChunk();
> const mpd::Representation *getCurrentRepresentation() const;
>
> private:
> diff --git a/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
> index 9fc71d4..f0defde 100644
> --- a/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
> @@ -27,7 +27,6 @@
>
> #include <http/Chunk.h>
> #include <adaptationlogic/IDownloadRateObserver.h>
> -#include <exceptions/EOFException.h>
> #include "mpd/Representation.h"
> #include "buffer/IBufferObserver.h"
>
> @@ -47,8 +46,8 @@ namespace dash
> RateBased
> };
>
> - virtual dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException) = 0;
> - virtual const dash::mpd::Representation *getCurrentRepresentation() const = 0;
> + virtual dash::http::Chunk* getNextChunk () = 0;
> + virtual const dash::mpd::Representation* getCurrentRepresentation() const = 0;
> /**
> * \return The average bitrate in bits per second.
> */
> diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> index 5214777..daa14a1 100644
> --- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> +++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
> @@ -31,7 +31,6 @@ using namespace dash::logic;
> using namespace dash::xml;
> using namespace dash::http;
> using namespace dash::mpd;
> -using namespace dash::exception;
>
> RateBasedAdaptationLogic::RateBasedAdaptationLogic (IMPDManager *mpdManager, stream_t *stream) :
> AbstractAdaptationLogic (mpdManager, stream),
> @@ -45,13 +44,13 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic (IMPDManager *mpdManager, st
> this->height = var_InheritInteger(stream, "dash-prefheight");
> }
>
> -Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
> +Chunk* RateBasedAdaptationLogic::getNextChunk()
> {
> if(this->mpdManager == NULL)
> - throw EOFException();
> + return NULL;
>
> if(this->currentPeriod == NULL)
> - throw EOFException();
> + return NULL;
>
> uint64_t bitrate = this->getBpsAvg();
>
> @@ -61,7 +60,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
> Representation *rep = this->mpdManager->getRepresentation(this->currentPeriod, bitrate, this->width, this->height);
>
> if ( rep == NULL )
> - throw EOFException();
> + return NULL;
>
> std::vector<Segment *> segments = this->mpdManager->getSegments(rep);
>
> diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> index 204de72..b53d0a9 100644
> --- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> +++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
> @@ -29,7 +29,6 @@
> #include "xml/Node.h"
> #include "mpd/IMPDManager.h"
> #include "http/Chunk.h"
> -#include "exceptions/EOFException.h"
> #include "mpd/BasicCMManager.h"
>
> #include <vlc_common.h>
> @@ -46,7 +45,7 @@ namespace dash
> public:
> RateBasedAdaptationLogic (dash::mpd::IMPDManager *mpdManager, stream_t *stream);
>
> - dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
> + dash::http::Chunk* getNextChunk();
> const dash::mpd::Representation *getCurrentRepresentation() const;
>
> private:
> diff --git a/modules/stream_filter/dash/exceptions/EOFException.h b/modules/stream_filter/dash/exceptions/EOFException.h
> deleted file mode 100644
> index 06a95d1..0000000
> --- a/modules/stream_filter/dash/exceptions/EOFException.h
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -/*
> - * EOFException.h
> - *****************************************************************************
> - * Copyright (C) 2010 - 2011 Klagenfurt University
> - *
> - * Created on: Aug 10, 2010
> - * Authors: Christopher Mueller <christopher.mueller at itec.uni-klu.ac.at>
> - * Christian Timmerer <christian.timmerer at itec.uni-klu.ac.at>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU Lesser General Public License as published
> - * by the Free Software Foundation; either version 2.1 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> - *****************************************************************************/
> -
> -#ifndef EOFEXCEPTION_H_
> -#define EOFEXCEPTION_H_
> -
> -#include <stdexcept>
> -
> -namespace dash
> -{
> - namespace exception
> - {
> - class EOFException : public std::exception
> - {
> - public:
> - EOFException() : std::exception() {}
> - };
> - }
> -}
> -
> -#endif /* EOFEXCEPTION_H_ */
> --
> 1.7.0.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
Good! This will allow us to disable exceptions for the android build :)
--
Hugo Beauzée-Luyssen
More information about the vlc-devel
mailing list