Stability improvements for live buffers / fixed issues with file extensions in RTMP stream names.
This commit is contained in:
parent
9bdf5ee19b
commit
39a386ab18
3 changed files with 20 additions and 10 deletions
|
@ -183,7 +183,7 @@ namespace Mist {
|
||||||
|
|
||||||
char tempMetaName[100];
|
char tempMetaName[100];
|
||||||
sprintf(tempMetaName, "liveStream_%s%d", config->getString("streamname").c_str(), tmpTid);
|
sprintf(tempMetaName, "liveStream_%s%d", config->getString("streamname").c_str(), tmpTid);
|
||||||
metaPages[tmpTid].init(tempMetaName, 8388608, true);
|
metaPages[tmpTid].init(tempMetaName, DEFAULT_META_PAGE_SIZE, true);
|
||||||
}
|
}
|
||||||
if (negotiateTracks.count(value)){
|
if (negotiateTracks.count(value)){
|
||||||
//Track is currently under negotiation, check whether the metadata has been submitted
|
//Track is currently under negotiation, check whether the metadata has been submitted
|
||||||
|
@ -261,7 +261,7 @@ namespace Mist {
|
||||||
((long long int *)indexPages[finalMap].mapped)[0] = htonl(1000);
|
((long long int *)indexPages[finalMap].mapped)[0] = htonl(1000);
|
||||||
sprintf(firstPage, "%s%d_%d", config->getString("streamname").c_str(), finalMap, keyNum);
|
sprintf(firstPage, "%s%d_%d", config->getString("streamname").c_str(), finalMap, keyNum);
|
||||||
///\todo Make size dynamic / other solution. 25mb is too much.
|
///\todo Make size dynamic / other solution. 25mb is too much.
|
||||||
dataPages[finalMap][0].init(firstPage, 26214400, true);
|
dataPages[finalMap][0].init(firstPage, DEFAULT_DATA_PAGE_SIZE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,12 +276,12 @@ namespace Mist {
|
||||||
//update current page
|
//update current page
|
||||||
int currentPage = dataPages[value].rbegin()->first;
|
int currentPage = dataPages[value].rbegin()->first;
|
||||||
updateMetaFromPage(value, currentPage);
|
updateMetaFromPage(value, currentPage);
|
||||||
if (inputLoc[value][currentPage].curOffset > 8388608) {
|
if (inputLoc[value][currentPage].curOffset > FLIP_DATA_PAGE_SIZE) {
|
||||||
int nextPage = currentPage + inputLoc[value][currentPage].keyNum;
|
int nextPage = currentPage + inputLoc[value][currentPage].keyNum;
|
||||||
char nextPageName[100];
|
char nextPageName[100];
|
||||||
sprintf(nextPageName, "%s%lu_%d", config->getString("streamname").c_str(), value, nextPage);
|
sprintf(nextPageName, "%s%lu_%d", config->getString("streamname").c_str(), value, nextPage);
|
||||||
dataPages[value][nextPage].init(nextPageName, 20971520, true);
|
dataPages[value][nextPage].init(nextPageName, DEFAULT_DATA_PAGE_SIZE, true);
|
||||||
DEVEL_MSG("Created page %s", nextPageName);
|
DEVEL_MSG("Created page %s, from pos %llu", nextPageName, inputLoc[value][currentPage].curOffset);
|
||||||
bool createdNew = false;
|
bool createdNew = false;
|
||||||
for (int i = 0; i < 8192; i += 8){
|
for (int i = 0; i < 8192; i += 8){
|
||||||
unsigned int thisKeyNum = ((((long long int *)(indexPages[value].mapped + i))[0]) >> 32) & 0xFFFFFFFF;
|
unsigned int thisKeyNum = ((((long long int *)(indexPages[value].mapped + i))[0]) >> 32) & 0xFFFFFFFF;
|
||||||
|
|
|
@ -197,17 +197,21 @@ namespace Mist {
|
||||||
}
|
}
|
||||||
int pageNum = bookKeeping[tNum].pageNum;
|
int pageNum = bookKeeping[tNum].pageNum;
|
||||||
std::string tmp = pack.toNetPacked();
|
std::string tmp = pack.toNetPacked();
|
||||||
if (bookKeeping[tNum].curOffset > 8388608 && pack.isMember("keyframe") && pack["keyframe"]){
|
if (bookKeeping[tNum].curOffset > FLIP_DATA_PAGE_SIZE && pack.isMember("keyframe") && pack["keyframe"]){
|
||||||
Util::sleep(500);
|
|
||||||
//open new page
|
//open new page
|
||||||
char nextPage[100];
|
char nextPage[100];
|
||||||
sprintf(nextPage, "%s%llu_%d", streamName.c_str(), tNum, bookKeeping[tNum].pageNum + bookKeeping[tNum].keyNum);
|
sprintf(nextPage, "%s%llu_%d", streamName.c_str(), tNum, bookKeeping[tNum].pageNum + bookKeeping[tNum].keyNum);
|
||||||
INFO_MSG("Continuing track %llu on page %d", tNum, bookKeeping[tNum].pageNum + bookKeeping[tNum].keyNum);
|
INFO_MSG("Continuing track %llu on page %d, from pos %llu", tNum, bookKeeping[tNum].pageNum + bookKeeping[tNum].keyNum, bookKeeping[tNum].curOffset);
|
||||||
curPages[tNum].init(nextPage, DEFAULT_DATA_PAGE_SIZE);
|
curPages[tNum].init(nextPage, DEFAULT_DATA_PAGE_SIZE);
|
||||||
bookKeeping[tNum].pageNum += bookKeeping[tNum].keyNum;
|
bookKeeping[tNum].pageNum += bookKeeping[tNum].keyNum;
|
||||||
bookKeeping[tNum].keyNum = 0;
|
bookKeeping[tNum].keyNum = 0;
|
||||||
bookKeeping[tNum].curOffset = 0;
|
bookKeeping[tNum].curOffset = 0;
|
||||||
}
|
}
|
||||||
|
if (!curPages[tNum].mapped){
|
||||||
|
//prevent page init failures from crashing everything.
|
||||||
|
myConn.close();//closes the connection to trigger a clean shutdown
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (bookKeeping[tNum].curOffset + tmp.size() < (unsigned long long)curPages[tNum].len){
|
if (bookKeeping[tNum].curOffset + tmp.size() < (unsigned long long)curPages[tNum].len){
|
||||||
bookKeeping[tNum].keyNum += (pack.isMember("keyframe") && pack["keyframe"]);
|
bookKeeping[tNum].keyNum += (pack.isMember("keyframe") && pack["keyframe"]);
|
||||||
memcpy(curPages[tNum].mapped + bookKeeping[tNum].curOffset, tmp.data(), tmp.size());
|
memcpy(curPages[tNum].mapped + bookKeeping[tNum].curOffset, tmp.data(), tmp.size());
|
||||||
|
|
|
@ -518,10 +518,16 @@ namespace Mist {
|
||||||
//handle variables
|
//handle variables
|
||||||
if (streamName.find('?') != std::string::npos){
|
if (streamName.find('?') != std::string::npos){
|
||||||
std::string tmpVars = streamName.substr(streamName.find('?') + 1);
|
std::string tmpVars = streamName.substr(streamName.find('?') + 1);
|
||||||
|
streamName = streamName.substr(0, streamName.find('?'));
|
||||||
parseVars(tmpVars);
|
parseVars(tmpVars);
|
||||||
Util::sanitizeName(streamName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t colonPos = streamName.find(':');
|
||||||
|
if (colonPos != std::string::npos && colonPos < 6){
|
||||||
|
std::string oldName = streamName;
|
||||||
|
streamName = oldName.substr(colonPos + 1) + std::string(".") + oldName.substr(0, colonPos);
|
||||||
|
}
|
||||||
|
Util::sanitizeName(streamName);
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
//send a status reply
|
//send a status reply
|
||||||
|
|
Loading…
Add table
Reference in a new issue