From eb9ea09db69f6ae0cad9ca30e61407011a93ebd8 Mon Sep 17 00:00:00 2001 From: Jeff Tinker Date: Thu, 15 Dec 2016 12:14:36 -0800 Subject: [PATCH] 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 --- proprietary/wvm/WVMExtractorImpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proprietary/wvm/WVMExtractorImpl.cpp b/proprietary/wvm/WVMExtractorImpl.cpp index 5fb3a50e..7e874c7c 100644 --- a/proprietary/wvm/WVMExtractorImpl.cpp +++ b/proprietary/wvm/WVMExtractorImpl.cpp @@ -26,6 +26,7 @@ using namespace android; static sp sDecryptHandle; static DrmManagerClient *sDrmManagerClient; +static Mutex gWVMutex; static void _cb1(char *data, unsigned long size) { @@ -88,6 +89,8 @@ bool IsWidevineMedia(const sp& 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) mError(OK), mSetupStatus(OK) { + Mutex::Autolock autoLock(gWVMutex); + dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient); //ALOGD("WVMExtractorImpl::WVMExtractorImpl: uniqueId = %d", sDrmManagerClient->mUniqueId);