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

Francois Cartegnie git at videolan.org
Mon Mar 30 16:15:50 CEST 2020


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

demux: adaptive: merge controls value updates

(cherry picked from commit ae99d8cdd002a20e0890bb712b4df7beb91fc4bd)

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

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

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index ab0dfe07dc..dc5b05aacc 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -158,7 +158,6 @@ bool PlaylistManager::init()
     playlist->playbackStart.Set(time(NULL));
     nextPlaylistupdate = playlist->playbackStart.Get();
 
-    updateControlsContentType();
     updateControlsPosition();
 
     return true;
@@ -398,7 +397,6 @@ bool PlaylistManager::updatePlaylist()
     for(it=streams.begin(); it!=streams.end(); ++it)
         (*it)->runUpdates();
 
-    updateControlsContentType();
     updateControlsPosition();
     return true;
 }
@@ -473,7 +471,6 @@ int PlaylistManager::doDemux(int64_t increment)
 
     AbstractStream::status status = dequeue(demux.i_nzpcr, &i_nzbarrier);
 
-    updateControlsContentType();
     updateControlsPosition();
 
     switch(status)
@@ -718,15 +715,26 @@ void * PlaylistManager::managerThread(void *opaque)
 void PlaylistManager::updateControlsPosition()
 {
     vlc_mutex_locker locker(&cached.lock);
-    const mtime_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 mtime_t i_length = getCurrentPlaybackTime() - getFirstPlaybackTime();
-        cached.f_position = (double) i_length / i_duration;
+        cached.f_position = (double) i_length / cached.i_length;
     }
 
     mtime_t i_time = getCurrentPlaybackTime();
@@ -735,21 +743,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 1182d7a21f..c2d0a9bd0f 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