Fix for unixrecstart/unixrecstop

This commit is contained in:
Thulinma 2020-05-07 21:15:46 +02:00
parent 19a4701be7
commit 753da9bd3f
2 changed files with 3 additions and 24 deletions

View file

@ -598,26 +598,6 @@ namespace Mist{
return end; return end;
} }
/// Return the most live time stamp of the selected tracks, or 0 if unknown or non-live.
/// Returns the time stamp of the newest track if nothing is selected.
/// Returns zero if no tracks exist.
uint64_t Output::liveTime(){
if (M.getVod()){return 0;}
if (M.getValidTracks().size()){return 0;}
uint64_t end = 0;
if (userSelect.size()){
for (std::map<size_t, Comms::Users>::iterator it = userSelect.begin(); it != userSelect.end(); it++){
if (end < M.getLastms(it->first)){end = M.getLastms(it->first);}
}
}else{
std::set<size_t> validTracks = M.getValidTracks();
for (std::set<size_t>::iterator it = validTracks.begin(); it != validTracks.end(); it++){
if (end < M.getLastms(*it)){end = M.getLastms(*it);}
}
}
return end;
}
/// Prepares all tracks from selectedTracks for seeking to the specified ms position. /// Prepares all tracks from selectedTracks for seeking to the specified ms position.
void Output::seekKeyframesIn(unsigned long long pos, unsigned long long maxDelta){ void Output::seekKeyframesIn(unsigned long long pos, unsigned long long maxDelta){
sought = true; sought = true;
@ -803,7 +783,7 @@ namespace Mist{
if (isRecordingToFile){ if (isRecordingToFile){
if (M.getLive() && if (M.getLive() &&
(targetParams.count("recstartunix") || targetParams.count("recstopunix"))){ (targetParams.count("recstartunix") || targetParams.count("recstopunix"))){
uint64_t unixStreamBegin = Util::epoch() - (liveTime() / 1000); uint64_t unixStreamBegin = Util::epoch() - endTime()/1000;
if (targetParams.count("recstartunix")){ if (targetParams.count("recstartunix")){
uint64_t startUnix = atoll(targetParams["recstartunix"].c_str()); uint64_t startUnix = atoll(targetParams["recstartunix"].c_str());
if (startUnix < unixStreamBegin){ if (startUnix < unixStreamBegin){
@ -885,7 +865,7 @@ namespace Mist{
targetParams["realtime"] = "1"; targetParams["realtime"] = "1";
} }
if (M.getLive() && (targetParams.count("startunix") || targetParams.count("stopunix"))){ if (M.getLive() && (targetParams.count("startunix") || targetParams.count("stopunix"))){
int64_t unixStreamBegin = Util::epoch() - (liveTime() / 1000); uint64_t unixStreamBegin = Util::epoch() - endTime()/1000;
if (targetParams.count("startunix")){ if (targetParams.count("startunix")){
int64_t startUnix = atoll(targetParams["startunix"].c_str()); int64_t startUnix = atoll(targetParams["startunix"].c_str());
if (startUnix < 0){ if (startUnix < 0){
@ -893,7 +873,7 @@ namespace Mist{
startUnix += Util::epoch(); startUnix += Util::epoch();
if (startUnix < unixStreamBegin){ if (startUnix < unixStreamBegin){
INFO_MSG("Waiting for stream to reach intended starting point"); INFO_MSG("Waiting for stream to reach intended starting point");
while (startUnix < Util::epoch() - (liveTime() / 1000) && keepGoing()){ while (startUnix < Util::epoch() - (endTime() / 1000) && keepGoing()){
Util::wait(1000); Util::wait(1000);
stats(); stats();
startUnix = origStartUnix + Util::epoch(); startUnix = origStartUnix + Util::epoch();

View file

@ -53,7 +53,6 @@ namespace Mist{
uint64_t currentTime(); uint64_t currentTime();
uint64_t startTime(); uint64_t startTime();
uint64_t endTime(); uint64_t endTime();
uint64_t liveTime();
void setBlocking(bool blocking); void setBlocking(bool blocking);
bool selectDefaultTracks(); bool selectDefaultTracks();
bool connectToFile(std::string file, bool append = false); bool connectToFile(std::string file, bool append = false);