Merge branch 'development' into LTS_development

# Conflicts:
#	src/input/input.cpp
This commit is contained in:
Thulinma 2017-08-03 15:08:48 +02:00
commit bb2e6de56a
4 changed files with 39 additions and 6 deletions

View file

@ -321,6 +321,7 @@ namespace DTSC {
std::string codec;
std::string type;
std::string lang;///< ISO 639-2 Language of track, empty or und if unknown.
uint32_t minKeepAway;///<Time in MS to never seek closer than live point to
//audio only
int rate;
int size;

View file

@ -1135,6 +1135,7 @@ namespace DTSC {
width = 0;
height = 0;
fpks = 0;
minKeepAway = 0;
}
///\brief Constructs a track from a JSON::Value
@ -1184,6 +1185,11 @@ namespace DTSC {
keySizes.push_back((((long unsigned)tmp[i]) << 24) | (((long unsigned)tmp[i+1]) << 16) | (((long unsigned int)tmp[i+2]) << 8) | tmp[i+3]);
}
}
if (trackRef.isMember("keepaway") && trackRef["keepaway"].isInt()){
minKeepAway = trackRef["keepaway"].asInt();
}else{
minKeepAway = 0;
}
}
///\brief Constructs a track from a JSON::Value
@ -1243,6 +1249,11 @@ namespace DTSC {
keySizes.push_back((((long unsigned)tmp[i]) << 24) | (((long unsigned)tmp[i+1]) << 16) | (((long unsigned int)tmp[i+2]) << 8) | tmp[i+3]);
}
}
if (trackRef.getMember("keepaway").getType() == DTSC_INT){
minKeepAway = trackRef.getMember("keepaway").asInt();
}else{
minKeepAway = 0;
}
}
///\brief Updates a track and its metadata given new packet properties.
@ -1712,6 +1723,9 @@ namespace DTSC {
if (!skipDynamic && missedFrags) {
result += 23;
}
if (minKeepAway){
result += 19;
}
return result;
}
@ -1814,6 +1828,10 @@ namespace DTSC {
writePointer(p, "\000\004fpks\001", 7);
writePointer(p, convertLongLong(fpks), 8);
}
if (minKeepAway){
writePointer(p, "\000\010keepaway\001", 11);
writePointer(p, convertLongLong(minKeepAway), 8);
}
writePointer(p, "\000\000\356", 3);//End this track Object
}
@ -1898,6 +1916,10 @@ namespace DTSC {
conn.SendNow("\000\004fpks\001", 7);
conn.SendNow(convertLongLong(fpks), 8);
}
if (minKeepAway){
conn.SendNow("\000\010keepaway\001", 11);
conn.SendNow(convertLongLong(minKeepAway), 8);
}
conn.SendNow("\000\000\356", 3);//End this track Object
}
@ -2058,6 +2080,11 @@ namespace DTSC {
result["height"] = height;
result["fpks"] = fpks;
}
if(minKeepAway){
result["keepaway"] = minKeepAway;
}
return result;
}

View file

@ -16,7 +16,7 @@ namespace Mist {
Input * Input::singleton = NULL;
void Input::userCallback(char * data, size_t len, unsigned int id) {
for (int i = 0; i < 5; i++) {
for (int i = 0; i < SIMUL_TRACKS; i++) {
unsigned long tid = ((unsigned long)(data[i * 6]) << 24) | ((unsigned long)(data[i * 6 + 1]) << 16) | ((unsigned long)(data[i * 6 + 2]) << 8) | ((unsigned long)(data[i * 6 + 3]));
if (tid) {
unsigned long keyNum = ((unsigned long)(data[i * 6 + 4]) << 8) | ((unsigned long)(data[i * 6 + 5]));
@ -140,6 +140,11 @@ namespace Mist {
while (config->is_active){
pid_t pid = fork();
if (pid == 0){
//Re-init streamStatus to fix Cygwin issues
char pageName[NAME_BUFFER_SIZE];
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_STATE, streamName.c_str());
streamStatus.init(pageName, 1, false, false);
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_INIT;}
if (needsLock()){playerLock.close();}
if (!preRun()){return 0;}
return run();

View file

@ -749,7 +749,7 @@ namespace Mist{
/// This function decides where in the stream initial playback starts.
/// The default implementation calls seek(0) for VoD.
/// For live, it seeks to the last sync'ed keyframe of the main track, no closer than needsLookAhead ms from the end.
/// For live, it seeks to the last sync'ed keyframe of the main track, no closer than needsLookAhead+minKeepAway ms from the end.
/// Unless lastms < 5000, then it seeks to the first keyframe of the main track.
/// Aborts if there is no main track or it has no keyframes.
void Output::initialSeek(){
@ -765,17 +765,17 @@ namespace Mist{
bool good = true;
//check if all tracks have data for this point in time
for (std::set<unsigned long>::iterator ti = selectedTracks.begin(); ti != selectedTracks.end(); ++ti){
if (myMeta.tracks[*ti].lastms < seekPos+needsLookAhead){good = false; break;}
if (mainTrack == *ti){continue;}//skip self
if (!myMeta.tracks.count(*ti)){
HIGH_MSG("Skipping track %lu, not in tracks", *ti);
continue;
}//ignore missing tracks
if (myMeta.tracks[*ti].lastms == myMeta.tracks[*ti].firstms){
DTSC::Track & thisTrack = myMeta.tracks[*ti];
if (thisTrack.lastms < seekPos+needsLookAhead+thisTrack.minKeepAway){good = false; break;}
if (mainTrack == *ti){continue;}//skip self
if (thisTrack.lastms == thisTrack.firstms){
HIGH_MSG("Skipping track %lu, last equals first", *ti);
continue;
}//ignore point-tracks
if (myMeta.tracks[*ti].lastms < seekPos){good = false; break;}
HIGH_MSG("Track %lu is good", *ti);
}
//if yes, seek here