Skip to content

Commit

Permalink
changed: allow cache buffer size to be configured via advancedsetting…
Browse files Browse the repository at this point in the history
…s rather than hardcoded.

Thanks ralfonat. Acked by elupus.

(cherry picked from commit acf0e0874177f9b44259d06528f61e7959a375d6)

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@35643 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
theuni committed Dec 17, 2010
1 parent 8d5c67a commit 5ed2f7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions xbmc/AdvancedSettings.cpp
Expand Up @@ -271,6 +271,8 @@ void CAdvancedSettings::Initialize()
m_bgInfoLoaderMaxThreads = 5;

m_measureRefreshrate = false;

m_cacheMemBufferSize = (1048576 * 5);
}

bool CAdvancedSettings::Load()
Expand Down Expand Up @@ -499,6 +501,7 @@ bool CAdvancedSettings::Load()
XMLUtils::GetInt(pElement, "curllowspeedtime", m_curllowspeedtime, 1, 1000);
XMLUtils::GetInt(pElement, "curlretries", m_curlretries, 0, 10);
XMLUtils::GetBoolean(pElement,"disableipv6", m_curlDisableIPV6);
XMLUtils::GetUInt(pElement, "cachemembuffersize", m_cacheMemBufferSize);
}

pElement = pRootElement->FirstChildElement("samba");
Expand Down
2 changes: 2 additions & 0 deletions xbmc/AdvancedSettings.h
Expand Up @@ -269,6 +269,8 @@ class CAdvancedSettings

DatabaseSettings m_databaseMusic; // advanced music database setup
DatabaseSettings m_databaseVideo; // advanced video database setup

unsigned int m_cacheMemBufferSize;
};

extern CAdvancedSettings g_advancedSettings;
Expand Down
9 changes: 4 additions & 5 deletions xbmc/FileSystem/CacheMemBuffer.cpp
Expand Up @@ -22,15 +22,14 @@
#ifdef _LINUX
#include "../linux/PlatformDefs.h"
#endif
#include "AdvancedSettings.h"
#include "CacheMemBuffer.h"
#include "utils/log.h"
#include "utils/SingleLock.h"
#include "utils/TimeUtils.h"

#include <math.h>

#define CACHE_BUFFER_SIZE (1048576 * 5)

using namespace XFILE;

#define SEEK_CHECK_RET(x) if (!(x)) return -1;
Expand All @@ -39,9 +38,9 @@ CacheMemBuffer::CacheMemBuffer()
: CCacheStrategy()
{
m_nStartPosition = 0;
m_buffer.Create(CACHE_BUFFER_SIZE + 1);
m_HistoryBuffer.Create(CACHE_BUFFER_SIZE + 1);
m_forwardBuffer.Create(CACHE_BUFFER_SIZE + 1);
m_buffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
m_HistoryBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
m_forwardBuffer.Create(g_advancedSettings.m_cacheMemBufferSize + 1);
}


Expand Down

0 comments on commit 5ed2f7b

Please sign in to comment.