From 3c41142a57323d7828416ef398f87d32221a9298 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 7 Jun 2016 15:20:44 +0200 Subject: [PATCH] RTMP track re-selection timer added. --- src/output/output_rtmp.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/output/output_rtmp.cpp b/src/output/output_rtmp.cpp index b7492671..323b5ae2 100644 --- a/src/output/output_rtmp.cpp +++ b/src/output/output_rtmp.cpp @@ -271,15 +271,22 @@ namespace Mist { //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 (selectedTracks.size() < 2 && myMeta.tracks.size() > 1){ - size_t prevTrackCount = selectedTracks.size(); - selectDefaultTracks(); - if (selectedTracks.size() > prevTrackCount){ - INFO_MSG("Picked up new track - selecting it and resetting state."); - sentHeader = false; - seek(thisPacket.getTime()); + if (selectedTracks.size() < 2){ + static unsigned long long lastMeta = 0; + if (Util::epoch() > lastMeta + 5){ + lastMeta = Util::epoch(); + updateMeta(); + if (myMeta.tracks.size() > 1){ + size_t prevTrackCount = selectedTracks.size(); + selectDefaultTracks(); + if (selectedTracks.size() > prevTrackCount){ + INFO_MSG("Picked up new track - selecting it and resetting state."); + sentHeader = false; + initialSeek(); + return; + } + } } - return; }