Converted previously hardcoded default sizes for shared memory pages to defines.
This commit is contained in:
parent
c99e0bc3ef
commit
43d35cf29b
8 changed files with 21 additions and 20 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <algorithm>
|
||||
#include <mist/timing.h>
|
||||
#include <mist/shared_memory.h>
|
||||
#include <mist/defines.h>
|
||||
#include "controller_storage.h"
|
||||
#include "controller_capabilities.h"
|
||||
|
||||
|
@ -80,7 +81,7 @@ namespace Controller {
|
|||
writeConf["streams"] = Storage["streams"];
|
||||
writeConf["capabilities"] = capabilities;
|
||||
|
||||
static IPC::sharedPage mistConfOut("!mistConfig", 4*1024*1024, true);
|
||||
static IPC::sharedPage mistConfOut("!mistConfig", DEFAULT_CONF_PAGE_SIZE, true);
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
//lock semaphore
|
||||
configLock.wait();
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Controller {
|
|||
//push-style stream
|
||||
if (hasViewers(name)){
|
||||
data["meta"].null();
|
||||
IPC::sharedPage streamIndex(name,8 * 1024 * 1024,false,false);
|
||||
IPC::sharedPage streamIndex(name, DEFAULT_META_PAGE_SIZE, false, false);
|
||||
if (!streamIndex.mapped){
|
||||
return;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace Controller {
|
|||
DEBUG_MSG(DLVL_INSANE, "Waiting for stream %s to open...", name.c_str());
|
||||
//wait for the stream
|
||||
{
|
||||
IPC::sharedPage streamIndex(name, 8 * 1024 * 1024);
|
||||
IPC::sharedPage streamIndex(name, DEFAULT_META_PAGE_SIZE);
|
||||
if (!streamIndex.mapped){
|
||||
DEBUG_MSG(DLVL_INSANE, "Stream %s opening failed! Cancelling and marking as corrupt.", name.c_str());
|
||||
data["meta"].null();
|
||||
|
|
|
@ -146,9 +146,9 @@ namespace Mist {
|
|||
//after this player functionality
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
metaPage.init(config->getString("streamname"), 8 * 1024 * 1024, true);
|
||||
metaPage.init(config->getString("streamname"), DEFAULT_META_PAGE_SIZE, true);
|
||||
#else
|
||||
metaPage.init(config->getString("streamname"), (isBuffer ? 8 * 1024 * 1024 : myMeta.getSendLen()), true);
|
||||
metaPage.init(config->getString("streamname"), (isBuffer ? DEFAULT_META_PAGE_SIZE : myMeta.getSendLen()), true);
|
||||
#endif
|
||||
myMeta.writeTo(metaPage.mapped);
|
||||
userPage.init(config->getString("streamname") + "_users", 30, true);
|
||||
|
@ -240,7 +240,7 @@ namespace Mist {
|
|||
pagesByTrack[it->first].rbegin()->second.keyNum++;
|
||||
pagesByTrack[it->first].rbegin()->second.partNum += it->second.keys[i].getParts();
|
||||
pagesByTrack[it->first].rbegin()->second.dataSize += it->second.keySizes[i];
|
||||
if (pagesByTrack[it->first].rbegin()->second.dataSize > 8 * 1024 * 1024){
|
||||
if (pagesByTrack[it->first].rbegin()->second.dataSize > FLIP_DATA_PAGE_SIZE){
|
||||
newData = true;
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ namespace Mist {
|
|||
indexPages[tid].init(tmpId, 8 * 1024, true);//Pages of 8kb in size, room for 512 parts.
|
||||
}
|
||||
if (myMeta.tracks[tid].keys[bookKeeping[tid].curKey].getParts() + 1 == curData[tid].partNum){
|
||||
if (curData[tid].dataSize > 8 * 1024 * 1024) {
|
||||
if (curData[tid].dataSize > FLIP_DATA_PAGE_SIZE) {
|
||||
pagesByTrack[tid][bookKeeping[tid].first] = curData[tid];
|
||||
bookKeeping[tid].first += curData[tid].keyNum;
|
||||
curData[tid].keyNum = 0;
|
||||
|
@ -331,7 +331,7 @@ namespace Mist {
|
|||
int pageIdLen = snprintf(pageId, 100, "%s%u_%u", config->getString("streamname").c_str(), track, pageNum);
|
||||
std::string tmpString(pageId, pageIdLen);
|
||||
#ifdef __CYGWIN__
|
||||
dataPages[track][pageNum].init(tmpString, 26 * 1024 * 1024, true);
|
||||
dataPages[track][pageNum].init(tmpString, DEFAULT_DATA_PAGE_SIZE, true);
|
||||
#else
|
||||
dataPages[track][pageNum].init(tmpString, it->second.dataSize, true);
|
||||
#endif
|
||||
|
|
|
@ -323,7 +323,7 @@ namespace Mist {
|
|||
std::string strName = config->getString("streamname");
|
||||
Util::sanitizeName(strName);
|
||||
strName = strName.substr(0,(strName.find('+')));
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024, false, false); ///< Contains server configuration and capabilities
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE, false, false); ///< Contains server configuration and capabilities
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
configLock.wait();
|
||||
DTSC::Scan streamCfg = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("streams").getMember(strName);
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace Mist {
|
|||
|
||||
char pageName[100];
|
||||
sprintf(pageName, "liveStream_%s%d", streamName.c_str(), newTid);
|
||||
metaPages[newTid].init(pageName, 8 * 1024 * 1024);
|
||||
metaPages[newTid].init(pageName, DEFAULT_META_PAGE_SIZE);
|
||||
DTSC::Meta tmpMeta = meta_out;
|
||||
tmpMeta.tracks.clear();
|
||||
tmpMeta.tracks[newTid] = meta_out.tracks[tid];
|
||||
|
@ -155,7 +155,7 @@ namespace Mist {
|
|||
INFO_MSG("Buffer has indicated that incoming track %d should start writing on track %d, page %d", tid, finalTid, firstPage);
|
||||
memset(pageName, 0, 100);
|
||||
sprintf(pageName, "%s%d_%d", streamName.c_str(), finalTid, firstPage);
|
||||
curPages[finalTid].init(pageName, 25 * 1024 * 1024);
|
||||
curPages[finalTid].init(pageName, DEFAULT_DATA_PAGE_SIZE);
|
||||
trackMap[tid] = finalTid;
|
||||
bookKeeping[finalTid] = DTSCPageData();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ namespace Mist {
|
|||
char nextPage[100];
|
||||
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);
|
||||
curPages[tNum].init(nextPage, 25 * 1024 * 1024);
|
||||
curPages[tNum].init(nextPage, DEFAULT_DATA_PAGE_SIZE);
|
||||
bookKeeping[tNum].pageNum += bookKeeping[tNum].keyNum;
|
||||
bookKeeping[tNum].keyNum = 0;
|
||||
bookKeeping[tNum].curOffset = 0;
|
||||
|
@ -236,7 +236,7 @@ namespace Mist {
|
|||
return;
|
||||
}
|
||||
isInitialized = true;
|
||||
streamIndex.init(streamName, 8 * 1024 * 1024);
|
||||
streamIndex.init(streamName, DEFAULT_META_PAGE_SIZE);
|
||||
if (!streamIndex.mapped){
|
||||
DEBUG_MSG(DLVL_FAIL, "Could not connect to server for %s\n", streamName.c_str());
|
||||
onFail();
|
||||
|
@ -439,7 +439,7 @@ namespace Mist {
|
|||
}
|
||||
char id[100];
|
||||
snprintf(id, 100, "%s%lu_%d", streamName.c_str(), trackId, pageNum);
|
||||
curPages[trackId].init(id, 26 * 1024 * 1024);
|
||||
curPages[trackId].init(id, DEFAULT_DATA_PAGE_SIZE);
|
||||
if (!(curPages[trackId].mapped)){
|
||||
DEBUG_MSG(DLVL_FAIL, "Initializing page %s failed", curPages[trackId].name.c_str());
|
||||
return;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Mist {
|
|||
//loop over the connectors
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
configLock.wait();
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024);
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE);
|
||||
DTSC::Scan capa = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("capabilities").getMember("connectors");
|
||||
unsigned int capa_ctr = capa.getSize();
|
||||
for (unsigned int i = 0; i < capa_ctr; ++i){
|
||||
|
@ -249,7 +249,7 @@ namespace Mist {
|
|||
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
configLock.wait();
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024);
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE);
|
||||
DTSC::Scan prots = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("config").getMember("protocols");
|
||||
unsigned int prots_ctr = prots.getSize();
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace Mist {
|
|||
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
configLock.wait();
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024);
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE);
|
||||
DTSC::Scan prtcls = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("config").getMember("protocols");
|
||||
DTSC::Scan capa = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("capabilities").getMember("connectors").getMember("RTMP");
|
||||
unsigned int pro_cnt = prtcls.getSize();
|
||||
|
@ -254,14 +254,14 @@ namespace Mist {
|
|||
IPC::semaphore metaLocker(std::string("liveMeta@" + streamName).c_str(), O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
bool metaLock = false;
|
||||
configLock.wait();
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024);
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE);
|
||||
DTSC::Scan strm = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("streams").getMember(streamName).getMember("meta");
|
||||
IPC::sharedPage streamIndex;
|
||||
if (!strm){
|
||||
configLock.post();
|
||||
//Stream metadata not found - attempt to start it
|
||||
if (Util::startInput(streamName)){
|
||||
streamIndex.init(streamName, 8 * 1024 * 1024);
|
||||
streamIndex.init(streamName, DEFAULT_META_PAGE_SIZE);
|
||||
if (streamIndex.mapped){
|
||||
metaLock = true;
|
||||
metaLocker.wait();
|
||||
|
|
|
@ -449,7 +449,7 @@ namespace Mist {
|
|||
streamName = amfData.getContentP(3)->StrValue();
|
||||
Util::sanitizeName(streamName);
|
||||
//pull the server configuration
|
||||
IPC::sharedPage serverCfg("!mistConfig", 4*1024*1024); ///< Contains server configuration and capabilities
|
||||
IPC::sharedPage serverCfg("!mistConfig", DEFAULT_CONF_PAGE_SIZE); ///< Contains server configuration and capabilities
|
||||
IPC::semaphore configLock("!mistConfLock", O_CREAT | O_RDWR, ACCESSPERMS, 1);
|
||||
configLock.wait();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue