Merge "Fix widevine drm hal resource leaks" into oc-dev

am: 27deb32b79

Change-Id: I38c2af0efde3c95c8399e0cb5118c8880864f2df
This commit is contained in:
Jeff Tinker
2017-05-15 20:09:19 +00:00
committed by android-build-merger
2 changed files with 11 additions and 7 deletions

View File

@@ -38,6 +38,7 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::sp;
using ::android::wp;
using android::status_t;
using std::map;
@@ -350,7 +351,7 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
sp<wvcdm::WvContentDecryptionModule> const mCDM;
WVGenericCryptoInterface* mCrypto;
map<CdmSessionId, CryptoSession> mCryptoSessions;
sp<IDrmPluginListener> mListener;
wp<IDrmPluginListener> mListener;
status_t queryProperty(const std::string& property,
std::string& stringValue) const;

View File

@@ -1122,8 +1122,9 @@ Return<void> WVDrmPlugin::setListener(const sp<IDrmPluginListener>& listener) {
Return<void> WVDrmPlugin::sendEvent(
EventType eventType,
const hidl_vec<uint8_t>& sessionId, const hidl_vec<uint8_t>& data) {
if (mListener != NULL) {
mListener->sendEvent(eventType, sessionId, data);
auto listener = mListener.promote();
if (listener != NULL) {
listener->sendEvent(eventType, sessionId, data);
} else {
ALOGE("Null event listener, event not sent");
}
@@ -1133,8 +1134,9 @@ Return<void> WVDrmPlugin::sendEvent(
Return<void> WVDrmPlugin::sendExpirationUpdate(
const hidl_vec<uint8_t>& sessionId,
int64_t expiryTimeInMS) {
if (mListener != NULL) {
mListener->sendExpirationUpdate(sessionId, expiryTimeInMS);
auto listener = mListener.promote();
if (listener != NULL) {
listener->sendExpirationUpdate(sessionId, expiryTimeInMS);
} else {
ALOGE("Null event listener, event not sent");
}
@@ -1144,8 +1146,9 @@ Return<void> WVDrmPlugin::sendExpirationUpdate(
Return<void> WVDrmPlugin::sendKeysChange(
const hidl_vec<uint8_t>& sessionId,
const hidl_vec<KeyStatus>& keyStatusList, bool hasNewUsableKey) {
if (mListener != NULL) {
mListener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
auto listener = mListener.promote();
if (listener != NULL) {
listener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey);
} else {
ALOGE("Null event listener, event not sent");
}