Merge branch 'development' into LTS_development
# Conflicts: # lib/stream.cpp # src/input/input.cpp
This commit is contained in:
commit
0ca63d1440
6 changed files with 27 additions and 0 deletions
|
@ -107,6 +107,14 @@ static inline void show_stackframe(){}
|
|||
#define FLIP_MIN_DURATION 20000
|
||||
|
||||
#define SHM_STREAM_INDEX "MstSTRM%s" //%s stream name
|
||||
#define SHM_STREAM_STATE "MstSTATE%s" //%s stream name
|
||||
#define STRMSTAT_OFF 0
|
||||
#define STRMSTAT_INIT 1
|
||||
#define STRMSTAT_BOOT 2
|
||||
#define STRMSTAT_WAIT 3
|
||||
#define STRMSTAT_READY 4
|
||||
#define STRMSTAT_SHUTDOWN 5
|
||||
#define STRMSTAT_INVALID 255
|
||||
#define SHM_TRACK_META "MstTRAK%s@%lu" //%s stream name, %lu track ID
|
||||
#define SHM_TRACK_INDEX "MstTRID%s@%lu" //%s stream name, %lu track ID
|
||||
#define SHM_TRACK_INDEX_SIZE 8192
|
||||
|
|
|
@ -472,3 +472,11 @@ static std::string strftime_now(const std::string& format) {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
uint8_t Util::getStreamStatus(std::string & streamname){
|
||||
char pageName[NAME_BUFFER_SIZE];
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_STATE, streamname.c_str());
|
||||
IPC::sharedPage streamStatus(pageName, 1, false, false);
|
||||
if (!streamStatus){return STRMSTAT_OFF;}
|
||||
return streamStatus.mapped[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,6 @@ namespace Util {
|
|||
bool startInput(std::string streamname, std::string filename = "", bool forkFirst = true, bool isProvider = false);
|
||||
int startPush(const std::string & streamname, std::string & target);
|
||||
JSON::Value getStreamConfig(std::string streamname);
|
||||
uint8_t getStreamStatus(std::string & streamname);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,10 @@ namespace Mist {
|
|||
DEBUG_MSG(DLVL_DEVEL, "A player for stream %s is already running", streamName.c_str());
|
||||
return 1;
|
||||
}
|
||||
char pageName[NAME_BUFFER_SIZE];
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_STATE, streamName.c_str());
|
||||
streamStatus.init(pageName, 1, true, false);
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_INIT;}
|
||||
}
|
||||
config->activate();
|
||||
uint64_t reTimer = 0;
|
||||
|
@ -158,6 +162,7 @@ namespace Mist {
|
|||
MEDIUM_MSG("Input for stream %s shut down cleanly", streamName.c_str());
|
||||
break;
|
||||
}
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_INVALID;}
|
||||
#if DEBUG >= DLVL_DEVEL
|
||||
WARN_MSG("Aborting autoclean; this is a development build.");
|
||||
INFO_MSG("Input for stream %s uncleanly shut down! Aborting restart; this is a development build.", streamName.c_str());
|
||||
|
@ -178,6 +183,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
int Input::run() {
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_BOOT;}
|
||||
checkHeaderTimes(config->getString("input"));
|
||||
if (!readHeader()) {
|
||||
std::cerr << "Reading header for " << config->getString("input") << " failed." << std::endl;
|
||||
|
@ -287,6 +293,7 @@ namespace Mist {
|
|||
}
|
||||
}
|
||||
/*LTS-END*/
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_READY;}
|
||||
|
||||
DEBUG_MSG(DLVL_DEVEL, "Input for stream %s started", streamName.c_str());
|
||||
activityCounter = Util::bootSecs();
|
||||
|
@ -310,6 +317,7 @@ namespace Mist {
|
|||
Util::wait(1000);
|
||||
}
|
||||
}
|
||||
if (streamStatus){streamStatus.mapped[0] = STRMSTAT_SHUTDOWN;}
|
||||
config->is_active = false;
|
||||
finish();
|
||||
DEBUG_MSG(DLVL_DEVEL, "Input for stream %s closing clean", streamName.c_str());
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace Mist {
|
|||
|
||||
//Create server for user pages
|
||||
IPC::sharedServer userPage;
|
||||
IPC::sharedPage streamStatus;
|
||||
|
||||
std::map<unsigned int, std::map<unsigned int, unsigned int> > pageCounter;
|
||||
|
||||
|
|
|
@ -571,6 +571,7 @@ namespace Mist {
|
|||
}
|
||||
}
|
||||
updateMeta();
|
||||
if (streamStatus){streamStatus.mapped[0] = hasPush ? STRMSTAT_READY : STRMSTAT_WAIT;}
|
||||
static bool everHadPush = false;
|
||||
if (hasPush) {
|
||||
hasPush = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue