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

Francois Cartegnie git at videolan.org
Tue Mar 24 23:35:20 CET 2020


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

demux: adaptive: add new buffering control options

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

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

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index fea803ef27..95b893c661 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -833,5 +833,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(VLC_TICK_FROM_MS(v));
+        v = var_InheritInteger(p_demux, "adaptive-maxbuffer");
+        if(v)
+            bl->setUserMinBuffering(VLC_TICK_FROM_MS(v));
+    }
+    return bl;
 }
diff --git a/modules/demux/adaptive/adaptive.cpp b/modules/demux/adaptive/adaptive.cpp
index e8857bb7fd..abf1429e3d 100644
--- a/modules/demux/adaptive/adaptive.cpp
+++ b/modules/demux/adaptive/adaptive.cpp
@@ -71,11 +71,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 +116,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 +136,10 @@ 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", 0, ADAPT_BUFFER_TEXT, ADAPT_BUFFER_LONGTEXT, true );
+        add_integer( "adaptive-maxbuffer", 0, 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