From 5c4e0d8c542dd1ce241aa4ea421b6894702c1a60 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Thu, 19 May 2016 17:32:40 +0200 Subject: [PATCH] More reasonable size for metadata --- lib/defines.h | 3 +++ src/controller/controller_statistics.cpp | 2 +- src/input/input_buffer.cpp | 4 ++-- src/io.cpp | 2 +- src/output/output.cpp | 2 +- src/output/output_http_internal.cpp | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/defines.h b/lib/defines.h index 74eb16e2..1cc05535 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -74,6 +74,9 @@ static const char * DBG_LVL_LIST[] = {"NONE", "FAIL", "ERROR", "WARN", "INFO", " /// The size used for stream header pages under Windows, where they cannot be size-detected. #define DEFAULT_META_PAGE_SIZE 16 * 1024 * 1024 +/// The size used for stream header pages under Windows, where they cannot be size-detected. +#define DEFAULT_STRM_PAGE_SIZE 4 * 1024 * 1024 + /// The size used for stream data pages under Windows, where they cannot be size-detected. #define DEFAULT_DATA_PAGE_SIZE SHM_DATASIZE * 1024 * 1024 diff --git a/src/controller/controller_statistics.cpp b/src/controller/controller_statistics.cpp index deb16ea0..b26ac066 100644 --- a/src/controller/controller_statistics.cpp +++ b/src/controller/controller_statistics.cpp @@ -872,7 +872,7 @@ void Controller::fillActive(JSON::Value & req, JSON::Value & rep, bool onlyNow){ char pageId[NAME_BUFFER_SIZE]; IPC::sharedPage streamIndex; snprintf(pageId, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, it->c_str()); - streamIndex.init(pageId, DEFAULT_META_PAGE_SIZE, false, false); + streamIndex.init(pageId, DEFAULT_STRM_PAGE_SIZE, false, false); if (streamIndex.mapped){ static char liveSemName[NAME_BUFFER_SIZE]; snprintf(liveSemName, NAME_BUFFER_SIZE, SEM_LIVE, it->c_str()); diff --git a/src/input/input_buffer.cpp b/src/input/input_buffer.cpp index 14695cef..7f133ec1 100644 --- a/src/input/input_buffer.cpp +++ b/src/input/input_buffer.cpp @@ -199,7 +199,7 @@ namespace Mist { }{ //Delete the stream index metapage. snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str()); - IPC::sharedPage erasePage(pageName, 1024, false, false); + IPC::sharedPage erasePage(pageName, DEFAULT_STRM_PAGE_SIZE, false, false); erasePage.master = true; } //Delete most if not all temporary track metadata pages. @@ -296,7 +296,7 @@ namespace Mist { if (!nProxy.metaPages.count(0) || !nProxy.metaPages[0].mapped) { char pageName[NAME_BUFFER_SIZE]; snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str()); - nProxy.metaPages[0].init(pageName, DEFAULT_META_PAGE_SIZE, true); + nProxy.metaPages[0].init(pageName, DEFAULT_STRM_PAGE_SIZE, true); nProxy.metaPages[0].master = false; } myMeta.writeTo(nProxy.metaPages[0].mapped); diff --git a/src/io.cpp b/src/io.cpp index 8a7273f0..91691e4d 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -16,7 +16,7 @@ namespace Mist { //Open the page for the metadata char pageName[NAME_BUFFER_SIZE]; snprintf(pageName, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str()); - nProxy.metaPages[0].init(pageName, myMeta.getSendLen(), true); + nProxy.metaPages[0].init(pageName, DEFAULT_STRM_PAGE_SIZE, true); //Make sure we don't delete it on accident nProxy.metaPages[0].master = false; diff --git a/src/output/output.cpp b/src/output/output.cpp index 1888e545..f4aa67d7 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -220,7 +220,7 @@ namespace Mist { char pageId[NAME_BUFFER_SIZE]; snprintf(pageId, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str()); nProxy.metaPages.clear(); - nProxy.metaPages[0].init(pageId, DEFAULT_META_PAGE_SIZE); + nProxy.metaPages[0].init(pageId, DEFAULT_STRM_PAGE_SIZE); if (!nProxy.metaPages[0].mapped){ FAIL_MSG("Could not connect to server for %s", streamName.c_str()); onFail(); diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index 419e446a..8962d581 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -362,7 +362,7 @@ namespace Mist { if (Util::startInput(streamName)){ char pageId[NAME_BUFFER_SIZE]; snprintf(pageId, NAME_BUFFER_SIZE, SHM_STREAM_INDEX, streamName.c_str()); - streamIndex.init(pageId, DEFAULT_META_PAGE_SIZE); + streamIndex.init(pageId, DEFAULT_STRM_PAGE_SIZE); if (streamIndex.mapped){ metaLock = true; metaLocker.wait();