Converted previously hardcoded default sizes for shared memory pages to defines.

This commit is contained in:
Thulinma 2015-01-27 12:03:52 +01:00
parent c99e0bc3ef
commit 43d35cf29b
8 changed files with 21 additions and 20 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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();

View file

@ -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();