From 0c16ae5a80e673e4a8efbe170f3220a894bb026f Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 21 Jul 2016 17:39:20 +0200 Subject: [PATCH] Added track-reselection to DTSC output --- src/output/output_dtsc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/output/output_dtsc.cpp b/src/output/output_dtsc.cpp index 238ece55..0327e0f0 100644 --- a/src/output/output_dtsc.cpp +++ b/src/output/output_dtsc.cpp @@ -52,6 +52,25 @@ namespace Mist { } void OutDTSC::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 (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; + } + } + } + } myConn.SendNow(thisPacket.getData(), thisPacket.getDataLen()); }