Added ability to disable resume support for live streams.
This commit is contained in:
parent
bf180a2a35
commit
ed5440e382
3 changed files with 49 additions and 1 deletions
|
@ -279,8 +279,10 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*LTS-END*/
|
/*LTS-END*/
|
||||||
|
if (config->is_active){
|
||||||
Util::sleep(1000);
|
Util::sleep(1000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
finish();
|
finish();
|
||||||
DEBUG_MSG(DLVL_DEVEL, "Input for stream %s closing clean", streamName.c_str());
|
DEBUG_MSG(DLVL_DEVEL, "Input for stream %s closing clean", streamName.c_str());
|
||||||
|
|
|
@ -60,6 +60,23 @@ namespace Mist {
|
||||||
capa["optional"]["cut"]["default"] = 0LL;
|
capa["optional"]["cut"]["default"] = 0LL;
|
||||||
option.null();
|
option.null();
|
||||||
|
|
||||||
|
option["arg"] = "integer";
|
||||||
|
option["long"] = "resume";
|
||||||
|
option["short"] = "R";
|
||||||
|
option["help"] = "Enable resuming support (1, default) or disable resuming support (0)";
|
||||||
|
option["value"].append(1LL);
|
||||||
|
config->addOption("resume", option);
|
||||||
|
capa["optional"]["resume"]["name"] = "Resume support";
|
||||||
|
capa["optional"]["resume"]["help"] = "If enabled, the buffer will linger after source disconnect to allow resuming the stream later. If disabled, the buffer will instantly close on source disconnect.";
|
||||||
|
capa["optional"]["resume"]["option"] = "--resume";
|
||||||
|
capa["optional"]["resume"]["type"] = "select";
|
||||||
|
capa["optional"]["resume"]["select"][0u][0u] = "1";
|
||||||
|
capa["optional"]["resume"]["select"][0u][1u] = "Enabled";
|
||||||
|
capa["optional"]["resume"]["select"][1u][0u] = "0";
|
||||||
|
capa["optional"]["resume"]["select"][1u][1u] = "Disabled";
|
||||||
|
capa["optional"]["resume"]["default"] = 1LL;
|
||||||
|
option.null();
|
||||||
|
|
||||||
option["arg"] = "integer";
|
option["arg"] = "integer";
|
||||||
option["long"] = "segment-size";
|
option["long"] = "segment-size";
|
||||||
option["short"] = "S";
|
option["short"] = "S";
|
||||||
|
@ -95,6 +112,7 @@ namespace Mist {
|
||||||
bufferTime = 50000;
|
bufferTime = 50000;
|
||||||
cutTime = 0;
|
cutTime = 0;
|
||||||
segmentSize = 5000;
|
segmentSize = 5000;
|
||||||
|
hasPush = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputBuffer::~inputBuffer(){
|
inputBuffer::~inputBuffer(){
|
||||||
|
@ -438,6 +456,14 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateMeta();
|
updateMeta();
|
||||||
|
static bool everHadPush = false;
|
||||||
|
if (hasPush){
|
||||||
|
hasPush = false;
|
||||||
|
everHadPush = true;
|
||||||
|
}else if(everHadPush && !resumeMode && config->is_active){
|
||||||
|
INFO_MSG("Shutting down buffer because resume mode is disabled and the source disconnected");
|
||||||
|
config->is_active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \triggers
|
/// \triggers
|
||||||
|
@ -637,6 +663,7 @@ namespace Mist {
|
||||||
if (metaPages[value].mapped){
|
if (metaPages[value].mapped){
|
||||||
//Update the metadata for this track
|
//Update the metadata for this track
|
||||||
updateTrackMeta(value);
|
updateTrackMeta(value);
|
||||||
|
hasPush = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -775,6 +802,23 @@ namespace Mist {
|
||||||
cutTime = tmpNum;
|
cutTime = tmpNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if stream is configured and setting is present, use it, always
|
||||||
|
if (streamCfg && streamCfg.getMember("resume")){
|
||||||
|
tmpNum = streamCfg.getMember("resume").asInt();
|
||||||
|
} else {
|
||||||
|
if (streamCfg){
|
||||||
|
//otherwise, if stream is configured use the default
|
||||||
|
tmpNum = config->getOption("resume", true)[0u].asInt();
|
||||||
|
} else {
|
||||||
|
//if not, use the commandline argument
|
||||||
|
tmpNum = config->getOption("resume").asInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if the new value is different, print a message and apply it
|
||||||
|
if (resumeMode != (bool)tmpNum){
|
||||||
|
DEBUG_MSG(DLVL_DEVEL, "Setting resume mode from %s to new value of %s", resumeMode?"enabled":"disabled", tmpNum?"enabled":"disabled");
|
||||||
|
resumeMode = tmpNum;
|
||||||
|
}
|
||||||
|
|
||||||
//if stream is configured and setting is present, use it, always
|
//if stream is configured and setting is present, use it, always
|
||||||
if (streamCfg && streamCfg.getMember("segmentsize")){
|
if (streamCfg && streamCfg.getMember("segmentsize")){
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace Mist {
|
||||||
unsigned int cutTime;
|
unsigned int cutTime;
|
||||||
unsigned int segmentSize; /*LTS*/
|
unsigned int segmentSize; /*LTS*/
|
||||||
unsigned int lastReTime; /*LTS*/
|
unsigned int lastReTime; /*LTS*/
|
||||||
|
bool hasPush; /*LTS*/
|
||||||
|
bool resumeMode; /*LTS*/
|
||||||
protected:
|
protected:
|
||||||
//Private Functions
|
//Private Functions
|
||||||
bool setup();
|
bool setup();
|
||||||
|
|
Loading…
Add table
Reference in a new issue