[vlc-commits] demux: adaptive: merge controls value updates

Francois Cartegnie git at videolan.org
Fri May 24 23:43:15 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 21 16:25:42 2019 +0200| [ae99d8cdd002a20e0890bb712b4df7beb91fc4bd] | committer: Francois Cartegnie

demux: adaptive: merge controls value updates

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

 modules/demux/adaptive/PlaylistManager.cpp | 34 ++++++++++++------------------
 modules/demux/adaptive/PlaylistManager.h   |  1 -
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 764e24a8e0..9b298ece52 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -157,7 +157,6 @@ bool PlaylistManager::init()
     playlist->playbackStart.Set(time(NULL));
     nextPlaylistupdate = playlist->playbackStart.Get();
 
-    updateControlsContentType();
     updateControlsPosition();
 
     return true;
@@ -385,7 +384,6 @@ bool PlaylistManager::updatePlaylist()
     for(it=streams.begin(); it!=streams.end(); ++it)
         (*it)->runUpdates();
 
-    updateControlsContentType();
     updateControlsPosition();
     return true;
 }
@@ -449,7 +447,6 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
 
     AbstractStream::status status = dequeue(demux.i_nzpcr, &i_nzbarrier);
 
-    updateControlsContentType();
     updateControlsPosition();
 
     switch(status)
@@ -694,15 +691,25 @@ void * PlaylistManager::managerThread(void *opaque)
 void PlaylistManager::updateControlsPosition()
 {
     vlc_mutex_locker locker(&cached.lock);
-    const vlc_tick_t i_duration = cached.i_length;
-    if(i_duration == 0)
+    if(playlist->isLive())
+    {
+        cached.b_live = true;
+        cached.i_length = 0;
+    }
+    else
+    {
+        cached.b_live = false;
+        cached.i_length = playlist->duration.Get();
+    }
+
+    if(cached.i_length == 0)
     {
         cached.f_position = 0.0;
     }
     else
     {
         const vlc_tick_t i_length = getCurrentPlaybackTime() - getFirstPlaybackTime();
-        cached.f_position = (double) i_length / i_duration;
+        cached.f_position = (double) i_length / cached.i_length;
     }
 
     vlc_tick_t i_time = getCurrentPlaybackTime();
@@ -711,21 +718,6 @@ void PlaylistManager::updateControlsPosition()
     cached.i_time = i_time;
 }
 
-void PlaylistManager::updateControlsContentType()
-{
-    vlc_mutex_locker locker(&cached.lock);
-    if(playlist->isLive())
-    {
-        cached.b_live = true;
-        cached.i_length = 0;
-    }
-    else
-    {
-        cached.b_live = false;
-        cached.i_length = playlist->duration.Get();
-    }
-}
-
 AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::LogicType type, AbstractConnectionManager *conn)
 {
     vlc_object_t *obj = VLC_OBJECT(p_demux);
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index d7623aea97..6d363f9ca9 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -87,7 +87,6 @@ namespace adaptive
             void unsetPeriod();
 
             void updateControlsPosition();
-            void updateControlsContentType();
 
             /* local factories */
             virtual AbstractAdaptationLogic *createLogic(AbstractAdaptationLogic::LogicType,



More information about the vlc-commits mailing list