Skip to content

Commit

Permalink
[rbp] Make cachemembuffersize default depend on memory size
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 3, 2020
1 parent 4cca43f commit af7e24b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
10 changes: 10 additions & 0 deletions xbmc/platform/linux/RBP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ServiceBroker.h"
#include "cores/omxplayer/OMXImage.h"
#include "rpi/rpi_user_vcsm.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/TimeUtils.h"
Expand Down Expand Up @@ -83,6 +84,12 @@ CRBP::~CRBP()
delete m_DllBcmHost;
}

void CRBP::InitializeSettings()
{
if (m_initialized && CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_cacheMemSize == ~0U)
CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_cacheMemSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20;
}

bool CRBP::Initialize()
{
CSingleLock lock(m_critSection);
Expand Down Expand Up @@ -122,6 +129,8 @@ bool CRBP::Initialize()
if (!m_gui_resolution_limit)
m_gui_resolution_limit = m_gpu_mem < 128 ? 720:1080;

InitializeSettings();

g_OMXImage.Initialize();
m_omx_image_init = true;
return true;
Expand All @@ -134,6 +143,7 @@ void CRBP::LogFirmwareVersion()
response[sizeof(response) - 1] = '\0';
CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response);
CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled);
CLog::Log(LOGNOTICE, "cache.memorysize: %dMB", CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_cacheMemSize >> 20);
m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int");
response[sizeof(response) - 1] = '\0';
CLog::Log(LOGNOTICE, "Config:\n%s", response);
Expand Down
1 change: 1 addition & 0 deletions xbmc/platform/linux/RBP.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class CRBP
~CRBP();

bool Initialize();
void InitializeSettings();
void LogFirmwareVersion();
void Deinitialize();
int GetArmMem() { return m_arm_mem; }
Expand Down
13 changes: 12 additions & 1 deletion xbmc/settings/AdvancedSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "utils/Variant.h"
#include "utils/XMLUtils.h"

#if defined(TARGET_RASPBERRY_PI)
#include "platform/linux/RBP.h"
#endif

using namespace ADDON;
using namespace XFILE;

Expand Down Expand Up @@ -382,7 +386,12 @@ void CAdvancedSettings::Initialize()
m_iPVRTimeshiftThreshold = 10;
m_bPVRTimeshiftSimpleOSD = true;

#ifdef TARGET_RASPBERRY_PI
// want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp
m_cacheMemSize = ~0;
#else
m_cacheMemSize = 1024 * 1024 * 20; // 20 MiB
#endif
m_cacheBufferMode = CACHE_BUFFER_MODE_INTERNET; // Default (buffer all internet streams/filesystems)
m_cacheChunkSize = 128 * 1024; // 128 KiB
// the following setting determines the readRate of a player data
Expand Down Expand Up @@ -431,7 +440,9 @@ void CAdvancedSettings::Initialize()
m_openGlDebugging = false;

m_userAgent = g_sysinfo.GetUserAgent();

#ifdef TARGET_RASPBERRY_PI
g_RBP.InitializeSettings();
#endif
m_initialized = true;
}

Expand Down

0 comments on commit af7e24b

Please sign in to comment.