Several fixes:

- Fixed bug in stream health function causing loop if track not active
- Fixed DTSC pulls ignoring data before the live point
- Improved async buffers (deque mode) to spread the tracks more fairly
- DTSC pull now implements "ping" and "error" commands
- DTSC pulls report suspicious keyframe intervals to the origin and ask for confirmation
- DTSC output now accepts these reports and disconnects if there is no match in keyframe intervals
- Outputs in async mode now keep the seek point in all tracks when reselecting
- Outputs in async mode now default to a starting position in each track that is at a keyframe roughly halfway in the buffer
- Outputs in async mode now ignore playback rate (always fastest possible)
- Removed code duplication in prepareNext function
- Reordered the prepareNext function somewhat to be easier to follow for humans
- DTSC output no longer overrides initialSeek function, now uses default implementation
- Sanitycheck output now supports both sync and async modes, supports printing multiple timestamps for multiple tracks
This commit is contained in:
Thulinma 2022-01-06 12:52:47 +01:00
parent b89875ea37
commit f560b88bfe
9 changed files with 257 additions and 222 deletions

View file

@ -1384,8 +1384,13 @@ namespace DTSC{
setType(newIdx, M.getType(*it));
setCodec(newIdx, M.getCodec(*it));
setLang(newIdx, M.getLang(*it));
setFirstms(newIdx, M.getFirstms(*it));
setLastms(newIdx, M.getLastms(*it));
if (copyData){
setFirstms(newIdx, M.getFirstms(*it));
setLastms(newIdx, M.getLastms(*it));
}else{
setFirstms(newIdx, 0);
setLastms(newIdx, 0);
}
setBps(newIdx, M.getBps(*it));
setMaxBps(newIdx, M.getMaxBps(*it));
setFpks(newIdx, M.getFpks(*it));
@ -3241,8 +3246,8 @@ namespace DTSC{
uint32_t longest_cnt = 0;
DTSC::Keys Mkeys(keys(i));
uint32_t firstKey = Mkeys.getFirstValid();
uint32_t endKey = Mkeys.getEndValid() - 1;
for (int k = firstKey; k < endKey; k++){
uint32_t endKey = Mkeys.getEndValid();
for (uint32_t k = firstKey; k+1 < endKey; k++){
uint64_t kDur = Mkeys.getDuration(k);
uint64_t kParts = Mkeys.getParts(k);
if (!kDur){continue;}

View file

@ -280,12 +280,10 @@ void Util::packetSorter::dropTrack(size_t tid){
/// Removes the first packet from the sorter and inserts the given packet.
void Util::packetSorter::replaceFirst(const sortedPageInfo &pInfo){
if (dequeMode){
//in deque mode, insertion of the new packet is at the back
//this works, as a failure to retrieve a packet will swap the front entry to the back as well
dequeBuffer.pop_front();
if (dequeBuffer.size() && dequeBuffer.front().time > pInfo.time){
dequeBuffer.push_front(pInfo);
}else{
dequeBuffer.push_back(pInfo);
}
dequeBuffer.push_back(pInfo);
}else{
setBuffer.erase(setBuffer.begin());
setBuffer.insert(pInfo);
@ -328,6 +326,20 @@ void Util::packetSorter::getTrackList(std::set<size_t> &toFill) const{
}
}
/// Fills toFill with track IDs and current playback position of tracks that are in the sorter.
void Util::packetSorter::getTrackList(std::map<size_t, uint64_t> &toFill) const{
toFill.clear();
if (dequeMode){
for (std::deque<Util::sortedPageInfo>::const_iterator it = dequeBuffer.begin(); it != dequeBuffer.end(); ++it){
toFill[it->tid] = it->time;
}
}else{
for (std::set<Util::sortedPageInfo>::const_iterator it = setBuffer.begin(); it != setBuffer.end(); ++it){
toFill[it->tid] = it->time;
}
}
}
JSON::Value Util::getStreamConfig(const std::string &streamname){
JSON::Value result;
if (streamname.size() > 100){

View file

@ -75,6 +75,7 @@ namespace Util{
void moveFirstToEnd();
bool hasEntry(size_t tid) const;
void getTrackList(std::set<size_t> &toFill) const;
void getTrackList(std::map<size_t, uint64_t> &toFill) const;
void setSyncMode(bool synced);
bool getSyncMode() const;
private: