DO NOT MERGE Move legacy widevine classic global lock from framework to

vendor/widevine implementation.

This prevents a hang on contention for the lock if the datasource
read blocks during sniffing.

bug:28888414
Change-Id: I3568a36b9de10b7e977b19f2f6c66106ff784d01
This commit is contained in:
Jeff Tinker
2016-12-15 12:14:36 -08:00
parent 1b298c6ec7
commit eb9ea09db6

View File

@@ -26,6 +26,7 @@ using namespace android;
static sp<DecryptHandle> sDecryptHandle;
static DrmManagerClient *sDrmManagerClient;
static Mutex gWVMutex;
static void _cb1(char *data, unsigned long size)
{
@@ -88,6 +89,8 @@ bool IsWidevineMedia(const sp<DataSource>& dataSource) {
ALOGV("IsWidevineMedia - insufficient data: %d", (int)bytesRead);
} else {
setenv("WV_SILENT", "true", 1);
Mutex::Autolock autoLock(gWVMutex);
result = WV_IsWidevineMedia(buffer, kSniffSize);
}
delete[] buffer;
@@ -110,6 +113,8 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
mError(OK),
mSetupStatus(OK)
{
Mutex::Autolock autoLock(gWVMutex);
dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient);
//ALOGD("WVMExtractorImpl::WVMExtractorImpl: uniqueId = %d", sDrmManagerClient->mUniqueId);