Support limiting output range for most outputs and outgoing pushes

This commit is contained in:
Thulinma 2023-05-16 02:56:45 +02:00
parent 3e2a17ff93
commit 7dbd60b208
21 changed files with 433 additions and 186 deletions

View file

@ -1656,7 +1656,7 @@ namespace Mist{
}
bufferFinalize(idx, page);
bufferTimer = Util::bootMS() - bufferTimer;
if (packCounter != tPages.getInt("parts", pageIdx)){
if (packCounter < tPages.getInt("parts", pageIdx)){
FAIL_MSG("Track %zu, page %" PRIu32 " (" PRETTY_PRINT_MSTIME " - " PRETTY_PRINT_MSTIME ") NOT FULLY buffered in %" PRIu64 "ms - erasing for later retry",
idx, pageNumber, PRETTY_ARG_MSTIME(tPages.getInt("firsttime", pageIdx)), PRETTY_ARG_MSTIME(thisTime), bufferTimer);
INFO_MSG(" (%" PRIu32 "/%" PRIu64 " parts, %" PRIu64 " bytes)", packCounter,

View file

@ -762,7 +762,10 @@ namespace Mist{
Util::logExitReason(ER_UNKNOWN, "Failed to load HLS playlist, aborting");
return;
}
uint64_t oldBootMsOffset = M.getBootMsOffset();
meta.reInit(isSingular() ? streamName : "", false);
meta.setUTCOffset(zUTC);
meta.setBootMsOffset(oldBootMsOffset);
INFO_MSG("Parsing live stream to create header...");
TS::Packet packet; // to analyse and extract data
int pidCounter = 1;
@ -831,7 +834,7 @@ namespace Mist{
INFO_MSG("Could not read existing header, regenerating");
return false;
}
if (!M.inputLocalVars.isMember("version") || M.inputLocalVars["version"].asInt() < 3){
if (!M.inputLocalVars.isMember("version") || M.inputLocalVars["version"].asInt() < 4){
INFO_MSG("Header needs update, regenerating");
return false;
}
@ -888,9 +891,9 @@ namespace Mist{
pidMapping[val] = key;
}
// Set bootMsOffset in order to display the program time correctly in the player
streamOffset = M.inputLocalVars["streamoffset"].asInt();
if (meta.getLive()){meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS()));}
meta.setBootMsOffset(streamOffset);
zUTC = M.inputLocalVars["zUTC"].asInt();
meta.setUTCOffset(zUTC);
if (M.getLive()){meta.setBootMsOffset(streamOffset);}
return true;
}
@ -999,12 +1002,12 @@ namespace Mist{
if (!config->is_active){return false;}
// set bootMsOffset in order to display the program time correctly in the player
if (meta.getLive()){meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS()));}
meta.setBootMsOffset(streamOffset);
meta.setUTCOffset(zUTC);
if (M.getLive()){meta.setBootMsOffset(streamOffset);}
if (streamIsLive || isLiveDVR){return true;}
// Set local vars used for parsing existing headers
meta.inputLocalVars["version"] = 3;
meta.inputLocalVars["version"] = 4;
// Write playlist entry info
JSON::Value allEntries;
@ -1029,7 +1032,7 @@ namespace Mist{
}
meta.inputLocalVars["playlist_urls"] = playlist_urls;
meta.inputLocalVars["playlistEntries"] = allEntries;
meta.inputLocalVars["streamoffset"] = streamOffset;
meta.inputLocalVars["zUTC"] = zUTC;
// Write packet ID mappings
JSON::Value thisMappingsR;
@ -1599,6 +1602,8 @@ namespace Mist{
INFO_MSG("Setting program unix start time to '%s' (%" PRIu64 ")", line.substr(pos + 1).c_str(), zUTC);
// store offset so that we can set it after reading the header
streamOffset = zUTC - (Util::unixMS() - Util::bootMS());
meta.setUTCOffset(zUTC);
if (M.getLive()){meta.setBootMsOffset(streamOffset);}
}else{
// ignore wrong lines
VERYHIGH_MSG("ignore wrong line: %s", line.c_str());