[vlc-commits] demux: adaptive: add new buffering control options

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


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 23 18:43:31 2020 +0100| [ba937729b8f2045780e48ba8eb85dfe4b7c318fc] | committer: Francois Cartegnie

demux: adaptive: add new buffering control options

(cherry picked from commit 2f3dab4ce5a5f508ce4359b1f78b6bcf9f7daa0a)

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

 modules/demux/adaptive/PlaylistManager.cpp | 12 +++++++++++-
 modules/demux/adaptive/adaptive.cpp        | 23 +++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 733c336202..e2d513c23d 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -847,5 +847,15 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
 
 AbstractBufferingLogic *PlaylistManager::createBufferingLogic() const
 {
-    return new DefaultBufferingLogic();
+    DefaultBufferingLogic *bl = new DefaultBufferingLogic();
+    if(bl)
+    {
+        unsigned v = var_InheritInteger(p_demux, "adaptive-livedelay");
+        if(v)
+            bl->setUserLiveDelay(CLOCK_FREQ / 1000 * v);
+        v = var_InheritInteger(p_demux, "adaptive-maxbuffer");
+        if(v)
+            bl->setUserMaxBuffering(CLOCK_FREQ / 1000 * v);
+    }
+    return bl;
 }
diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index c46acc9be3..628dc09c81 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -34,6 +34,7 @@
 
 #include "SharedResources.hpp"
 #include "playlist/BasePeriod.h"
+#include "logic/BufferingLogic.hpp"
 #include "xml/DOMParser.h"
 
 #include "../dash/DASHManager.h"
@@ -71,11 +72,19 @@ static void Close   (vlc_object_t *);
 #define ADAPT_BW_TEXT N_("Fixed Bandwidth in KiB/s")
 #define ADAPT_BW_LONGTEXT N_("Preferred bandwidth for non adaptive streams")
 
+#define ADAPT_BUFFER_TEXT N_("Live Playback delay (ms)")
+#define ADAPT_BUFFER_LONGTEXT N_("Tradeoff between stability and real time")
+
+#define ADAPT_MAXBUFFER_TEXT N_("Max buffering (ms)")
+
 #define ADAPT_LOGIC_TEXT N_("Adaptive Logic")
 
 #define ADAPT_ACCESS_TEXT N_("Use regular HTTP modules")
 #define ADAPT_ACCESS_LONGTEXT N_("Connect using HTTP access instead of custom HTTP code")
 
+#define ADAPT_LOWLATENCY_TEXT N_("Low latency")
+#define ADAPT_LOWLATENCY_LONGTEXT N_("Overrides low latency parameters")
+
 static const AbstractAdaptationLogic::LogicType pi_logics[] = {
                                 AbstractAdaptationLogic::Default,
                                 AbstractAdaptationLogic::Predictive,
@@ -108,6 +117,12 @@ static_assert( ARRAY_SIZE( pi_logics ) == ARRAY_SIZE( ppsz_logics ),
 static_assert( ARRAY_SIZE( pi_logics ) == ARRAY_SIZE( ppsz_logics_values ),
     "pi_logics and ppsz_logics_values shall have the same number of elements" );
 
+static const int rgi_latency[] = { -1, 1, 0 };
+
+static const char *const ppsz_latency[] = { N_("Auto"),
+                                            N_("Force"),
+                                            N_("Disable") };
+
 vlc_module_begin ()
         set_shortname( N_("Adaptive"))
         set_description( N_("Unified adaptive streaming for DASH/HLS") )
@@ -122,6 +137,14 @@ vlc_module_begin ()
                      ADAPT_HEIGHT_TEXT, ADAPT_HEIGHT_TEXT, false )
         add_integer( "adaptive-bw",     250, ADAPT_BW_TEXT,     ADAPT_BW_LONGTEXT,     false )
         add_bool   ( "adaptive-use-access", false, ADAPT_ACCESS_TEXT, ADAPT_ACCESS_LONGTEXT, true );
+        add_integer( "adaptive-livedelay",
+                     AbstractBufferingLogic::DEFAULT_LIVE_BUFFERING / 1000,
+                     ADAPT_BUFFER_TEXT, ADAPT_BUFFER_LONGTEXT, true );
+        add_integer( "adaptive-maxbuffer",
+                     AbstractBufferingLogic::DEFAULT_MAX_BUFFERING  / 1000,
+                     ADAPT_MAXBUFFER_TEXT, NULL, true );
+        add_integer( "adaptive-lowlatency", -1, ADAPT_LOWLATENCY_TEXT, ADAPT_LOWLATENCY_LONGTEXT, true );
+            change_integer_list(rgi_latency, ppsz_latency)
         set_callbacks( Open, Close )
 vlc_module_end ()
 



More information about the vlc-commits mailing list