Configure the Widevine cache buffer size via a property

The property ro.com.widevine.cachesize may be set on a device to override the
default stream buffer cache size.

related-to-bug: 6819880

Change-Id: I27da154e38289c5d1f5f2f5f424202253d0721cc
This commit is contained in:
Jeffrey Tinker
2012-08-22 09:17:58 -07:00
parent 196fe01488
commit 14f0deafac
2 changed files with 15 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
#define LOG_TAG "WVMExtractorImpl"
#include <utils/Log.h>
#include <cutils/qtaguid.h>
#include <cutils/properties.h>
#include "WVMExtractorImpl.h"
#include "WVMMediaSource.h"
@@ -159,13 +160,13 @@ void WVMExtractorImpl::Initialize()
// Use the URI - streaming case, only for widevine:// protocol
result = WV_Setup(mSession, mDataSource->getUri().string(),
"RAW/RAW/RAW;destination=getdata", credentials,
WV_OutputFormat_ES, kStreamCacheSize, mClientContext.get());
WV_OutputFormat_ES, getStreamCacheSize(), mClientContext.get());
} else {
// No URI supplied or not adaptive, pull data from the stagefright data source.
mFileSource = new WVMFileSource(mDataSource);
result = WV_Setup(mSession, mFileSource.get(),
"RAW/RAW/RAW;destination=getdata", credentials,
WV_OutputFormat_ES, kStreamCacheSize, mClientContext.get());
WV_OutputFormat_ES, getStreamCacheSize(), mClientContext.get());
}
if (result != WV_Status_OK) {
@@ -580,4 +581,13 @@ void WVMExtractorImpl::setUID(uid_t uid)
mClientContext->setUID(uid);
}
size_t WVMExtractorImpl::getStreamCacheSize() const
{
char value[PROPERTY_VALUE_MAX];
snprintf(value, sizeof(value), "%d", kDefaultStreamCacheSize);
property_get("ro.com.widevine.cachesize", value, NULL);
return atol(value);
}
} // namespace android