diff --git a/src/output/output.cpp b/src/output/output.cpp index afeeae64..a91fd1cb 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -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"; diff --git a/src/output/output_rtmp.cpp b/src/output/output_rtmp.cpp index 862cd3e9..c12f48b5 100644 --- a/src/output/output_rtmp.cpp +++ b/src/output/output_rtmp.cpp @@ -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; }