Limit how long startInput() will wait for an input to finish booting or shutting down

This commit is contained in:
Thulinma 2018-10-26 16:12:53 +02:00
parent b2995ea2db
commit ee9b076b76

View file

@ -143,7 +143,9 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
//Note: this uses the _whole_ stream name, including + (if any). //Note: this uses the _whole_ stream name, including + (if any).
//This means "test+a" and "test+b" have separate locks and do not interact with each other. //This means "test+a" and "test+b" have separate locks and do not interact with each other.
uint8_t streamStat = getStreamStatus(streamname); uint8_t streamStat = getStreamStatus(streamname);
while (streamStat != STRMSTAT_OFF && streamStat != STRMSTAT_READY && (!isProvider || streamStat != STRMSTAT_WAIT)){ //Wait for a maximum of 240 x 250ms sleeps = 60 seconds
size_t sleeps = 0;
while (++sleeps < 240 && streamStat != STRMSTAT_OFF && streamStat != STRMSTAT_READY && (!isProvider || streamStat != STRMSTAT_WAIT)){
if (streamStat == STRMSTAT_BOOT && overrides.count("throughboot")){ if (streamStat == STRMSTAT_BOOT && overrides.count("throughboot")){
break; break;
} }