diff --git a/proprietary/wvm/WVMExtractorImpl.cpp b/proprietary/wvm/WVMExtractorImpl.cpp index 978d98ae..1942d224 100644 --- a/proprietary/wvm/WVMExtractorImpl.cpp +++ b/proprietary/wvm/WVMExtractorImpl.cpp @@ -5,6 +5,7 @@ #define LOG_TAG "WVMExtractorImpl" #include #include +#include #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 diff --git a/proprietary/wvm/include/WVMExtractorImpl.h b/proprietary/wvm/include/WVMExtractorImpl.h index 7a48e1e0..346ae3b6 100644 --- a/proprietary/wvm/include/WVMExtractorImpl.h +++ b/proprietary/wvm/include/WVMExtractorImpl.h @@ -80,7 +80,9 @@ private: status_t readMetaData(); - const static size_t kStreamCacheSize = 10 * 1024 * 1024; + size_t getStreamCacheSize() const; + + const static size_t kDefaultStreamCacheSize = 10 * 1024 * 1024; WVMExtractorImpl(const WVMExtractorImpl &); WVMExtractorImpl &operator=(const WVMExtractorImpl &);