Added options to DTSC pull for controlling the buffer config. Made 8X target duration the default buffer size. Inputs now wait for INPUT_TIMEOUT *and* two biggestFragment durations, added a few helper functions to DTSC::Meta. Buffer now automatically sets segment size to min(configed_size, biggest_fragment/2) to prevent sudden reductions of fragment sizes by more than 50%

This commit is contained in:
Thulinma 2016-10-11 15:02:29 +02:00
parent 65a225ed95
commit 22cd84fcd5
5 changed files with 43 additions and 5 deletions

View file

@ -326,6 +326,8 @@ namespace DTSC {
void toPrettyString(std::ostream & str, int indent = 0, int verbosity = 0);
//members:
std::map<unsigned int, Track> tracks;
Track & mainTrack();
uint32_t biggestFragment();
bool vod;
bool live;
bool merged;

View file

@ -1347,6 +1347,28 @@ namespace DTSC {
}
}
/// Returns a reference to the first video track, or the first track.
/// Beware: returns a reference to invalid memory if there are no tracks!
/// Will print a WARN-level message if this is the case.
Track & Meta::mainTrack(){
if (!tracks.size()){
WARN_MSG("Returning nonsense reference - crashing is likely");
return tracks.begin()->second;
}
for (std::map<unsigned int, Track>::iterator it = tracks.begin(); it != tracks.end(); it++) {
if (it->second.type == "video"){
return it->second;
}
}
return tracks.begin()->second;
}
/// Returns 0 if there are no tracks, otherwise calls mainTrack().biggestFragment().
uint32_t Meta::biggestFragment(){
if (!tracks.size()){return 0;}
return mainTrack().biggestFragment();
}
///\brief Converts a track to a human readable string
///\param str The stringstream to append to
///\param indent the amount of indentation needed