[vlc-devel] [PATCH 4/6] demux: adaptive: reorder cleanup_push and cleanup_pop

Zhao Zhili quinkblack at foxmail.com
Wed Sep 20 05:50:37 CEST 2017


---
  modules/demux/adaptive/PlaylistManager.cpp | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index 706ece0..96a0a57 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -23,6 +23,9 @@
  # include "config.h"
  #endif

+#include <assert.h>
+#include <vlc_common.h>
+
  #include "PlaylistManager.h"
  #include "SegmentTracker.hpp"
  #include "playlist/AbstractPlaylist.hpp"
@@ -621,15 +624,14 @@ void PlaylistManager::setBufferingRunState(bool b)
  void PlaylistManager::Run()
  {
      vlc_mutex_lock(&lock);
+    mutex_cleanup_push(&lock);
      const unsigned i_min_buffering = playlist->getMinBuffering();
      const unsigned i_extra_buffering = playlist->getMaxBuffering() - 
i_min_buffering;
      while(1)
      {
-        mutex_cleanup_push(&lock);
          while(!b_buffering)
              vlc_cond_wait(&waitcond, &lock);
          vlc_testcancel();
-        vlc_cleanup_pop();

          if(needsUpdate())
          {
@@ -665,14 +667,14 @@ void PlaylistManager::Run()
              vlc_cond_signal(&demux.cond);
              vlc_mutex_unlock(&demux.lock);

-            mutex_cleanup_push(&lock);
              while(b_buffering &&
                      vlc_cond_timedwait(&waitcond, &lock, i_deadline) 
== 0 &&
                      i_deadline > mdate());
-            vlc_cleanup_pop();
          }
      }
+    vlc_cleanup_pop();
      vlc_mutex_unlock(&lock);
+    vlc_assert_unreachable();
  }

  void * PlaylistManager::managerThread(void *opaque)
-- 
2.7.4


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-demux-adaptive-reorder-cleanup_push-and-cleanup_pop.patch
Type: text/x-patch
Size: 1857 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170920/ffff5742/attachment.bin>


More information about the vlc-devel mailing list