[vlc-commits] stream_filter: dash: get rid of the useless thread_sys

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:53 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Dec  5 16:59:09 2014 +0100| [8741c01919dbc376d8a6aa2ffdf22bde63788043] | committer: Francois Cartegnie

stream_filter: dash: get rid of the useless thread_sys

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

 modules/stream_filter/dash/DASHDownloader.cpp |   28 +++++++++++--------------
 modules/stream_filter/dash/DASHDownloader.h   |    9 ++------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp
index e1a0587..30f4859 100644
--- a/modules/stream_filter/dash/DASHDownloader.cpp
+++ b/modules/stream_filter/dash/DASHDownloader.cpp
@@ -33,42 +33,38 @@ using namespace dash::logic;
 using namespace dash::buffer;
 
 
-DASHDownloader::DASHDownloader  (HTTPConnectionManager *conManager, BlockBuffer *buffer)
+DASHDownloader::DASHDownloader  (HTTPConnectionManager *conManager_, BlockBuffer *buffer_)
 {
-    this->t_sys                     = (thread_sys_t *) malloc(sizeof(thread_sys_t));
-    this->t_sys->conManager         = conManager;
-    this->t_sys->buffer             = buffer;
+    conManager = conManager_;
+    buffer = buffer_;
 }
 DASHDownloader::~DASHDownloader ()
 {
-    this->t_sys->buffer->setEOF(true);
+    buffer->setEOF(true);
     vlc_join(this->dashDLThread, NULL);
-    free(this->t_sys);
 }
 
 bool        DASHDownloader::start       ()
 {
-    if(vlc_clone(&(this->dashDLThread), download, (void*)this->t_sys, VLC_THREAD_PRIORITY_LOW))
+    if(vlc_clone(&(this->dashDLThread), download, static_cast<void*>(this), VLC_THREAD_PRIORITY_LOW))
         return false;
 
     return true;
 }
-void*       DASHDownloader::download    (void *thread_sys)
+void* DASHDownloader::download(void *dashDownloader)
 {
-    thread_sys_t            *t_sys              = (thread_sys_t *) thread_sys;
-    HTTPConnectionManager   *conManager         = t_sys->conManager;
-    BlockBuffer             *buffer             = t_sys->buffer;
-    int                     ret                 = 0;
+    DASHDownloader *me = static_cast<DASHDownloader*>(dashDownloader);
+    int ret = 0;
 
     do
     {
         block_t *block = NULL;
-        ret = conManager->read(Streams::VIDEO, &block);
+        ret = me->conManager->read(Streams::VIDEO, &block);
         if(ret > 0)
-            buffer->put(block);
-    }while(ret > 0 && !buffer->getEOF());
+            me->buffer->put(block);
+    }while(ret > 0 && !me->buffer->getEOF());
 
-    buffer->setEOF(true);
+    me->buffer->setEOF(true);
 
     return NULL;
 }
diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h
index a9d4eac..0cbbaf4 100644
--- a/modules/stream_filter/dash/DASHDownloader.h
+++ b/modules/stream_filter/dash/DASHDownloader.h
@@ -35,12 +35,6 @@
 
 namespace dash
 {
-    struct thread_sys_t
-    {
-        dash::http::HTTPConnectionManager   *conManager;
-        buffer::BlockBuffer                 *buffer;
-    };
-
     class DASHDownloader
     {
         public:
@@ -51,8 +45,9 @@ namespace dash
             static void*    download    (void *);
 
         private:
-            thread_sys_t    *t_sys;
             vlc_thread_t    dashDLThread;
+            http::HTTPConnectionManager *conManager;
+            buffer::BlockBuffer         *buffer;
     };
 }
 



More information about the vlc-commits mailing list