Fix widevine drm hal resource leaks

A strong pointer cycle was preventing the drm plugin
from being released.  This change converts the listener
to a weak pointer to break the cycle.

bug:36408047
test: manual testing to verify leaks are fixed
Change-Id: I2e2af392c2b263b7b0943d61dcaee5e94089ce27
This commit is contained in:
Jeff Tinker
2017-05-09 14:31:07 -07:00
parent 35fc4edc11
commit 006506278a
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;