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);