Added pushdelay option for outward pushes, fixed negative starttime for RTMP output

This commit is contained in:
Thulinma 2019-08-22 16:14:27 +02:00
parent 2475955125
commit 2cb20efa7a
2 changed files with 21 additions and 3 deletions

View file

@ -1093,11 +1093,28 @@ namespace Mist{
seekPos = startRec;
}
}else{
if (myMeta.live && targetParams.count("pushdelay")){
INFO_MSG("Converting pushdelay syntax into corresponding startunix+realtime options");
targetParams["startunix"] = std::string("-")+targetParams["pushdelay"];
targetParams["realtime"] = "1";
}
if (myMeta.live && (targetParams.count("startunix") || targetParams.count("stopunix"))){
uint64_t unixStreamBegin = Util::epoch() - (liveTime() / 1000);
if (targetParams.count("startunix")){
long long startUnix = atoll(targetParams["startunix"].c_str());
if (startUnix < 0){startUnix += Util::epoch();}
if (startUnix < 0){
long long origStartUnix = startUnix;
startUnix += Util::epoch();
if (startUnix < unixStreamBegin){
INFO_MSG("Waiting for stream to reach intended starting point");
while (startUnix < Util::epoch() - (liveTime() / 1000) && keepGoing()){
Util::wait(1000);
updateMeta();
stats();
startUnix = origStartUnix + Util::epoch();
}
}
}
if (startUnix < unixStreamBegin){
WARN_MSG("Start time is earlier than stream begin - starting earliest possible");
targetParams["start"] = "-1";

View file

@ -43,8 +43,9 @@ namespace Mist{
streamOut = streamName;
}
}
initialize();
INFO_MSG("About to push stream %s out. Host: %s, port: %d, app: %s, stream: %s", streamName.c_str(), pushUrl.host.c_str(), pushUrl.getPort(), app.c_str(), streamOut.c_str());
initialize();
initialSeek();
startPushOut("");
}else{
setBlocking(true);
@ -1094,7 +1095,7 @@ namespace Mist{
sendCommand(amfReply, 20, 1);
}
HIGH_MSG("Publish starting");
realTime = 0;
if (!targetParams.count("realtime")){realTime = 0;}
parseData = true;
return;
}