From 4fb10315080485199f9d63dbf23a1a0a68853182 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Sat, 27 Jun 2020 00:12:39 +0200 Subject: [PATCH] Decreased RTMP latency --- src/output/output_rtmp.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/output/output_rtmp.cpp b/src/output/output_rtmp.cpp index 64088a4c..ab46b17e 100644 --- a/src/output/output_rtmp.cpp +++ b/src/output/output_rtmp.cpp @@ -73,7 +73,7 @@ namespace Mist{ setBlocking(false); } - maxSkipAhead = 1500; + maxSkipAhead = 0; } void OutRTMP::startPushOut(const char *args){ @@ -340,21 +340,18 @@ namespace Mist{ } void OutRTMP::sendNext(){ - // If there are now more selectable tracks, select the new track and do a seek to the current - // timestamp Set sentHeader to false to force it to send init data - if (M.getLive() && userSelect.size() < 2){ + //Every 5s, check if the track selection should change in live streams, and do it. + if (M.getLive()){ static uint64_t lastMeta = 0; if (Util::epoch() > lastMeta + 5){ lastMeta = Util::epoch(); - std::set validTracks = getSupportedTracks(); - if (validTracks.size() > 1){ - if (selectDefaultTracks()){ - INFO_MSG("Track selection changed - resending headers and continuing"); - sentHeader = false; - return; - } + if (selectDefaultTracks()){ + INFO_MSG("Track selection changed - resending headers and continuing"); + sentHeader = false; + return; } } + if (liveSeek()){return;} } if (streamOut.size()){