Fix fallback stream, added support for stream variables in fallback stream
This commit is contained in:
parent
aa77d86df1
commit
f8251cc115
2 changed files with 22 additions and 2 deletions
|
@ -326,9 +326,12 @@ namespace Mist{
|
||||||
// If stream is configured, use fallback stream setting, if set.
|
// If stream is configured, use fallback stream setting, if set.
|
||||||
JSON::Value strCnf = Util::getStreamConfig(streamName);
|
JSON::Value strCnf = Util::getStreamConfig(streamName);
|
||||||
if (strCnf && strCnf["fallback_stream"].asStringRef().size()){
|
if (strCnf && strCnf["fallback_stream"].asStringRef().size()){
|
||||||
streamName = strCnf["fallback_stream"].asStringRef();
|
std::string defStrm = strCnf["fallback_stream"].asStringRef();
|
||||||
|
std::string newStrm = defStrm;
|
||||||
|
Util::streamVariables(newStrm, streamName, "");
|
||||||
|
INFO_MSG("Switching to configured fallback stream '%s' -> '%s'", defStrm.c_str(), newStrm.c_str());
|
||||||
|
streamName = newStrm;
|
||||||
Util::setStreamName(streamName);
|
Util::setStreamName(streamName);
|
||||||
INFO_MSG("Switching to configured fallback stream '%s'", streamName.c_str());
|
|
||||||
reconnect();
|
reconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,6 +433,23 @@ namespace Mist{
|
||||||
if (streamStatus != STRMSTAT_READY){
|
if (streamStatus != STRMSTAT_READY){
|
||||||
// If we haven't rewritten the stream name yet to a fallback, attempt to do so
|
// If we haven't rewritten the stream name yet to a fallback, attempt to do so
|
||||||
if (origStreamName == streamName){
|
if (origStreamName == streamName){
|
||||||
|
// If stream is configured, use fallback stream setting, if set.
|
||||||
|
JSON::Value strCnf = Util::getStreamConfig(streamName);
|
||||||
|
if (strCnf && strCnf["fallback_stream"].asStringRef().size()){
|
||||||
|
std::string defStrm = strCnf["fallback_stream"].asStringRef();
|
||||||
|
std::string newStrm = defStrm;
|
||||||
|
Util::streamVariables(newStrm, streamName, "");
|
||||||
|
if (streamName != newStrm){
|
||||||
|
INFO_MSG("Switching to configured fallback stream '%s' -> '%s'", defStrm.c_str(), newStrm.c_str());
|
||||||
|
origStreamName = streamName;
|
||||||
|
streamName = newStrm;
|
||||||
|
Util::setStreamName(streamName);
|
||||||
|
reconnect();
|
||||||
|
return getStatusJSON(reqHost, useragent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//global fallback stream
|
||||||
JSON::Value defStrmJson = Util::getGlobalConfig("defaultStream");
|
JSON::Value defStrmJson = Util::getGlobalConfig("defaultStream");
|
||||||
std::string defStrm = defStrmJson.asString();
|
std::string defStrm = defStrmJson.asString();
|
||||||
if (Triggers::shouldTrigger("DEFAULT_STREAM", streamName)){
|
if (Triggers::shouldTrigger("DEFAULT_STREAM", streamName)){
|
||||||
|
|
Loading…
Add table
Reference in a new issue