Live stream inputs now track buffer status
This commit is contained in:
parent
d117835757
commit
d6bd9bee46
2 changed files with 17 additions and 1 deletions
|
@ -180,6 +180,8 @@ namespace Mist{
|
||||||
|
|
||||||
hasSrt = false;
|
hasSrt = false;
|
||||||
srtTrack = 0;
|
srtTrack = 0;
|
||||||
|
lastBufferCheck = 0;
|
||||||
|
bufferPid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::checkHeaderTimes(std::string streamFile){
|
void Input::checkHeaderTimes(std::string streamFile){
|
||||||
|
@ -734,7 +736,7 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
overrides["singular"] = "";
|
overrides["singular"] = "";
|
||||||
if (!Util::startInput(streamName, "push://INTERNAL_ONLY:" + config->getString("input"), true,
|
if (!Util::startInput(streamName, "push://INTERNAL_ONLY:" + config->getString("input"), true,
|
||||||
true, overrides)){// manually override stream url to start the buffer
|
true, overrides, &bufferPid)){// manually override stream url to start the buffer
|
||||||
WARN_MSG("Could not start buffer, cancelling");
|
WARN_MSG("Could not start buffer, cancelling");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -782,6 +784,13 @@ namespace Mist{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Input::bufferActive(){
|
||||||
|
if (bufferPid && Util::bootSecs() > lastBufferCheck){
|
||||||
|
if (!Util::Procs::isRunning(bufferPid)){bufferPid = 0;}
|
||||||
|
}
|
||||||
|
return bufferPid;
|
||||||
|
}
|
||||||
|
|
||||||
void Input::streamMainLoop(){
|
void Input::streamMainLoop(){
|
||||||
uint64_t statTimer = 0;
|
uint64_t statTimer = 0;
|
||||||
uint64_t startTime = Util::bootSecs();
|
uint64_t startTime = Util::bootSecs();
|
||||||
|
@ -795,6 +804,10 @@ namespace Mist{
|
||||||
Util::logExitReason("buffer requested shutdown");
|
Util::logExitReason("buffer requested shutdown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!bufferActive()){
|
||||||
|
Util::logExitReason("Buffer shut down");
|
||||||
|
return;
|
||||||
|
}
|
||||||
bufferLivePacket(thisPacket);
|
bufferLivePacket(thisPacket);
|
||||||
getNext();
|
getNext();
|
||||||
if (!thisPacket){
|
if (!thisPacket){
|
||||||
|
|
|
@ -102,6 +102,9 @@ namespace Mist{
|
||||||
uint64_t simStartTime;
|
uint64_t simStartTime;
|
||||||
|
|
||||||
IPC::sharedPage pidPage; ///Stores responsible input process PID
|
IPC::sharedPage pidPage; ///Stores responsible input process PID
|
||||||
|
bool bufferActive(); ///< Returns true if the buffer process for this stream input is alive.
|
||||||
|
pid_t bufferPid;
|
||||||
|
uint64_t lastBufferCheck;///< Time of last buffer liveness check.
|
||||||
|
|
||||||
void handleBuyDRM();
|
void handleBuyDRM();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue