Process system updates:

All processes:
- Added process status system and relevant API calls
- Added ability to set track masks for input/output in processes
- Added support for unmasking tracks when there is a push target, by the "unmask" parameter.
- Added track unmasking support for processes on exit/error
- Make processes start faster, if possible, in the first few seconds of a stream
- Delay stream ready state if there are processes attempting to start

Livepeer process updates:
- Added Content-Resolution header to MistProcLivepeer as per Livepeer's request
- Renamed transcode from "Mist Transcode" to source stream name
- Added ability to send audio to livepeer
- Robustified livepeer timing code, shutdown code, and improved GUI
- Prevent "audio keyframes" from starting segments in MistProcLivepeer
- Multithreaded (2 upload threads) livepeer process
- Stricter downloader/uploader timeout behaviour
- Robustness improvements
- Fix small segment size 😒
- Streamname correction
- Prevent getting stuck when transcoding multiple qualities and they are not equal length
- Corrected log message print error
- Race condition fix
- Now always waits for at least 1 video track
This commit is contained in:
Thulinma 2020-07-29 16:50:09 +02:00
parent f88a8fc51c
commit 209cd4c0fc
15 changed files with 891 additions and 352 deletions

View file

@ -520,6 +520,12 @@ void Controller::handleAPICommands(JSON::Value &Request, JSON::Value &Response){
setPushStatus(statUp["id"].asInt(), statUp["status"]);
}
}
if (Request.isMember("proc_status_update")){
JSON::Value &statUp = Request["proc_status_update"];
if (statUp.isMember("id") && statUp.isMember("status") && statUp.isMember("source") && statUp.isMember("proc") && statUp.isMember("sink")){
setProcStatus(statUp["id"].asInt(), statUp["proc"].asStringRef(), statUp["source"].asStringRef(), statUp["sink"].asStringRef(), statUp["status"]);
}
}
/*LTS-END*/
if (Request.isMember("config_backup")){
@ -1076,6 +1082,10 @@ void Controller::handleAPICommands(JSON::Value &Request, JSON::Value &Response){
}
}
if (Request.isMember("proc_list")){
getProcsForStream(Request["proc_list"].asStringRef(), Response["proc_list"]);
}
if (Request.isMember("push_list")){Controller::listPush(Response["push_list"]);}
if (Request.isMember("push_stop")){

View file

@ -55,6 +55,7 @@ namespace Controller{
Storage["log"].append(m);
Storage["log"].shrink(100); // limit to 100 log messages
if (isPushActive(progPid)){pushLogMessage(progPid, m);} //LTS
if (isProcActive(progPid)){procLogMessage(progPid, m);} //LTS
logCounter++;
if (rlxLogs && rlxLogs->isReady()){
if (!firstLog){firstLog = logCounter;}

View file

@ -3,6 +3,7 @@
#include "controller_statistics.h"
#include "controller_storage.h"
#include "controller_streams.h"
#include <mist/timing.h>
#include <map>
#include <mist/config.h>
#include <mist/defines.h>
@ -18,6 +19,62 @@
namespace Controller{
std::map<std::string, pid_t> inputProcesses;
/// Internal list of currently active processes
class procInfo{
public:
JSON::Value stats;
std::string source;
std::string proc;
std::string sink;
uint64_t lastupdate;
JSON::Value logs;
};
std::map<pid_t, procInfo> activeProcs;
void procLogMessage(uint64_t id, const JSON::Value & msg){
JSON::Value &log = activeProcs[id].logs;
log.append(msg);
log.shrink(25);
}
bool isProcActive(uint64_t id){
return activeProcs.count(id);
}
void getProcsForStream(const std::string & stream, JSON::Value & returnedProcList){
std::set<pid_t> wipeList;
for (std::map<pid_t, procInfo>::iterator it = activeProcs.begin(); it != activeProcs.end(); ++it){
if (!stream.size() || stream == it->second.sink || stream == it->second.source){
JSON::Value & thisProc = returnedProcList[JSON::Value(it->first).asString()];
thisProc = it->second.stats;
thisProc["source"] = it->second.source;
thisProc["sink"] = it->second.sink;
thisProc["process"] = it->second.proc;
thisProc["logs"] = it->second.logs;
if (!Util::Procs::isRunning(it->first)){
thisProc["terminated"] = true;
wipeList.insert(it->first);
}
}
}
while (wipeList.size()){
activeProcs.erase(*wipeList.begin());
wipeList.erase(wipeList.begin());
}
}
void setProcStatus(uint64_t id, const std::string & proc, const std::string & source, const std::string & sink, const JSON::Value & status){
procInfo & prc = activeProcs[id];
prc.lastupdate = Util::bootSecs();
prc.stats.extend(status);
if (!prc.proc.size() && sink.size() && source.size() && proc.size()){
prc.sink = sink;
prc.source = source;
prc.proc = proc;
}
}
///\brief Checks whether two streams are equal.
///\param one The first stream for the comparison.
///\param two The second stream for the comparison.

View file

@ -1,6 +1,10 @@
#include <mist/json.h>
namespace Controller{
void setProcStatus(uint64_t id, const std::string & proc, const std::string & source, const std::string & sink, const JSON::Value & status);
void getProcsForStream(const std::string & stream, JSON::Value & returnedProcList);
void procLogMessage(uint64_t id, const JSON::Value & msg);
bool isProcActive(uint64_t id);
bool streamsEqual(JSON::Value &one, JSON::Value &two);
void checkStream(std::string name, JSON::Value &data);
bool CheckAllStreams(JSON::Value &data);