[vlc-commits] demux: adaptive: fix invalid use of thread_t

Francois Cartegnie git at videolan.org
Mon Jul 25 20:59:22 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jul 25 20:48:21 2016 +0200| [f5c69224c235dae08d2122f14163f65aa74f7f1e] | committer: Francois Cartegnie

demux: adaptive: fix invalid use of thread_t

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

 modules/demux/adaptive/PlaylistManager.cpp | 10 ++++++----
 modules/demux/adaptive/PlaylistManager.h   |  1 +
 modules/demux/adaptive/http/Downloader.cpp |  1 -
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 0ef0ea8..a25a98e 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -58,7 +58,7 @@ PlaylistManager::PlaylistManager( demux_t *p_demux_,
 {
     currentPeriod = playlist->getFirstPeriod();
     failedupdates = 0;
-    thread = 0;
+    b_thread = false;
     b_buffering = false;
     nextPlaylistupdate = 0;
     demux.i_nzpcr = VLC_TS_INVALID;
@@ -160,7 +160,9 @@ bool PlaylistManager::start()
     updateControlsContentType();
     updateControlsPosition();
 
-    if(vlc_clone(&thread, managerThread, reinterpret_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT))
+    b_thread = !vlc_clone(&thread, managerThread,
+                          reinterpret_cast<void *>(this), VLC_THREAD_PRIORITY_INPUT);
+    if(!b_thread)
         return false;
 
     setBufferingRunState(true);
@@ -170,11 +172,11 @@ bool PlaylistManager::start()
 
 void PlaylistManager::stop()
 {
-    if(thread)
+    if(b_thread)
     {
         vlc_cancel(thread);
         vlc_join(thread, NULL);
-        thread = 0;
+        b_thread = false;
     }
 }
 
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index 7d9c643..a8c4cd8 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -129,6 +129,7 @@ namespace adaptive
             static void * managerThread(void *);
             vlc_mutex_t  lock;
             vlc_thread_t thread;
+            bool         b_thread;
             vlc_cond_t   waitcond;
             bool         b_buffering;
     };
diff --git a/modules/demux/adaptive/http/Downloader.cpp b/modules/demux/adaptive/http/Downloader.cpp
index c948947..164ad74 100644
--- a/modules/demux/adaptive/http/Downloader.cpp
+++ b/modules/demux/adaptive/http/Downloader.cpp
@@ -33,7 +33,6 @@ Downloader::Downloader()
     vlc_mutex_init(&lock);
     vlc_cond_init(&waitcond);
     killed = false;
-    thread_handle = { 0 };
     thread_handle_valid = false;
 }
 



More information about the vlc-commits mailing list