More backports from Pro edition, among which HTTPS/TLS support

This commit is contained in:
Thulinma 2019-07-13 14:15:43 +02:00
parent 2432bbdfc3
commit cc9e970ea3
26 changed files with 733 additions and 324 deletions

View file

@ -581,16 +581,34 @@ namespace Mist {
std::string trackIdentifier = trackMeta.tracks.find(value)->second.getIdentifier();
DEBUG_MSG(DLVL_HIGH, "Attempting colision detection for track %s", trackIdentifier.c_str());
//Get the identifier for the track, and attempt colission detection.
int collidesWith = -1;
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) {
//If the identifier of an existing track and the current track match, assume the are the same track and reject the negotiated one.
///\todo Maybe switch to a new form of detecting collisions, especially with regards to multiple audio languages and camera angles.
if (it->second.getIdentifier() == trackIdentifier) {
collidesWith = it->first;
break;
}
}
//Remove the "negotiate" status in either case
negotiatingTracks.erase(value);
//Set master to true before erasing the page, because we are responsible for cleaning up unused pages
nProxy.metaPages[value].master = true;
nProxy.metaPages.erase(value);
int finalMap = 3;
if (trackMeta.tracks.find(value)->second.type == "video"){finalMap = 1;}
if (trackMeta.tracks.find(value)->second.type == "audio"){finalMap = 2;}
//Check if the track collides, and whether the track it collides with is active.
if (collidesWith != -1 && activeTracks.count(collidesWith)) { /*LTS*/
//Print a warning message and set the state of the track to rejected.
WARN_MSG("Collision of temporary track %lu with existing track %d detected. Handling as a new valid track.", value, collidesWith);
collidesWith = -1;
}
uint64_t finalMap = collidesWith;
if (finalMap == -1) {
//No collision has been detected, assign a new final number
finalMap = (myMeta.tracks.size() ? myMeta.tracks.rbegin()->first : 0) + 1;
DEBUG_MSG(DLVL_DEVEL, "No colision detected for temporary track %lu from user %u, assigning final track number %lu", value, id, finalMap);
}
//Resume either if we have more than 1 keyframe on the replacement track (assume it was already pushing before the track "dissapeared")
//or if the firstms of the replacement track is later than the lastms on the existing track
if (!myMeta.tracks.count(finalMap) || trackMeta.tracks.find(value)->second.keys.size() > 1 || trackMeta.tracks.find(value)->second.firstms >= myMeta.tracks[finalMap].lastms) {

View file

@ -144,7 +144,7 @@ namespace Mist {
bool inputDTSC::openStreamSource() {
std::string source = config->getString("input");
if (source == "-"){
srcConn = Socket::Connection(fileno(stdout),fileno(stdin));
srcConn.open(fileno(stdout),fileno(stdin));
return true;
}
if (source.find("dtsc://") == 0) {
@ -159,7 +159,7 @@ namespace Mist {
if (streamName == "") {
streamName = givenStream;
}
srcConn = Socket::Connection(host, port, true);
srcConn.open(host, port, true);
if (!srcConn.connected()){
return false;
}

View file

@ -44,9 +44,9 @@ namespace Mist{
int fin = -1, fout = -1;
inputProcess = Util::Procs::StartPiped(args, &fin, &fout, 0);
myConn = Socket::Connection(-1, fout);
myConn.open(-1, fout);
}else{
myConn = Socket::Connection(fileno(stdout), fileno(stdin));
myConn.open(fileno(stdout), fileno(stdin));
}
myConn.Received().splitter.assign("\000\000\001", 3);
myMeta.vod = false;