Merge from Widevine repo of http://go/wvgerrit/47860 This CL updates the copyright notice to indicate that files shared with partners are shared under the Widevine Master License Agreement. bug: 77926774 test: comment change only Change-Id: I0423668111578b80fb39a932d763df2827e2dfc3
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
//
|
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
//
|
|
|
|
//#define LOG_NDEBUG 0
|
|
#define LOG_TAG "WVCdm"
|
|
#include <utils/Log.h>
|
|
|
|
#include "WVCDMSingleton.h"
|
|
|
|
#include "utils/Mutex.h"
|
|
#include "utils/RefBase.h"
|
|
|
|
namespace wvdrm {
|
|
|
|
using wvcdm::WvContentDecryptionModule;
|
|
using android::Mutex;
|
|
using android::sp;
|
|
using android::wp;
|
|
|
|
Mutex cdmLock;
|
|
// The strong pointers that keep this object alive live in the plugin objects.
|
|
// If all the plugins are deleted, the CDM will be deleted, and subsequent
|
|
// invocations of this code will construct a new CDM.
|
|
wp<WvContentDecryptionModule> sCdm;
|
|
|
|
sp<WvContentDecryptionModule> getCDM() {
|
|
Mutex::Autolock lock(cdmLock); // This function is a critical section.
|
|
|
|
sp<WvContentDecryptionModule> cdm = sCdm.promote();
|
|
|
|
if (cdm == NULL) {
|
|
ALOGD("Instantiating CDM.");
|
|
cdm = new WvContentDecryptionModule();
|
|
sCdm = cdm;
|
|
}
|
|
|
|
return cdm;
|
|
}
|
|
|
|
} // namespace wvdrm
|