Set livepeer-transcoded track to have a source track, exclude tracks with source track from stream health info

This commit is contained in:
Thulinma 2022-01-20 01:52:54 +01:00
parent bb84a5a20c
commit 75559a367b
2 changed files with 22 additions and 10 deletions

View file

@ -3233,7 +3233,6 @@ namespace DTSC{
JSON::Value &track = retRef[getTrackIdentifier(i)];
uint64_t minKeep = getMinKeepAway(*it);
track["jitter"] = minKeep;
if (jitter < minKeep){jitter = minKeep;}
std::string codec = getCodec(i);
std::string type = getType(i);
track["kbits"] = getBps(i) * 8 / 1024;
@ -3266,16 +3265,26 @@ namespace DTSC{
track["keys"]["frames_max"] = longest_cnt;
uint64_t trBuffer = getLastms(i) - getFirstms(i);
track["buffer"] = trBuffer;
size_t srcTrk = getSourceTrack(i);
if (srcTrk != INVALID_TRACK_ID){
if (trackValid(srcTrk)){
track["source"] = getTrackIdentifier(srcTrk);
}else{
track["source"] = "Invalid track " + JSON::Value(srcTrk).asString();
}
}else{
if (jitter < minKeep){jitter = minKeep;}
if (longest_prt > 500){
issues << "unstable connection (" << longest_prt << "ms " << codec << " frame)! ";
}
if (shrtest_cnt < 6){
issues << "unstable connection (" << shrtest_cnt << " " << codec << " frame(s) in key)! ";
}
if (longest_key > shrtest_key*1.30){
issues << "unstable key interval (" << (uint32_t)(((longest_key/shrtest_key)-1)*100) << "% " << codec << " variance)! ";
}
}
if (buffer < trBuffer){buffer = trBuffer;}
if (longest_prt > 500){
issues << "unstable connection (" << longest_prt << "ms " << codec << " frame)! ";
}
if (shrtest_cnt < 6){
issues << "unstable connection (" << shrtest_cnt << " " << codec << " frame(s) in key)! ";
}
if (longest_key > shrtest_key*1.30){
issues << "unstable key interval (" << (uint32_t)(((longest_key/shrtest_key)-1)*100) << "% " << codec << " variance)! ";
}
if (codec == "AAC"){hasAAC = true;}
if (codec == "H264"){hasH264 = true;}
if (type == "video"){

View file

@ -33,6 +33,7 @@ Util::Config conf;
size_t insertTurn = 0;
bool isStuck = false;
size_t sourceIndex = INVALID_TRACK_ID;
namespace Mist{
@ -134,6 +135,7 @@ namespace Mist{
}
if (thisTime > statSourceMs){statSourceMs = thisTime;}
if (thisPacket.getFlag("keyframe") && M.trackLoaded(thisIdx) && M.getType(thisIdx) == "video" && (thisTime - presegs[currPreSeg].time) >= 1000){
sourceIndex = getMainSelectedTrack();
if (presegs[currPreSeg].data.size() > 187){
presegs[currPreSeg].keyNo = keyCount;
presegs[currPreSeg].width = M.getWidth(thisIdx);
@ -233,6 +235,7 @@ namespace Mist{
INFO_MSG("Initializing track %zi as %" PRIu64 " for playlist %zu", thisPacket.getTrackId(), trackId, S.ID);
S.S.initializeMetadata(meta, thisPacket.getTrackId(), trackId);
thisIdx = M.trackIDToIndex(trackId, getpid());
meta.setSourceTrack(thisIdx, sourceIndex);
}
}
if (S.byteOffset >= S.data.size() && !S.S.hasPacket()){