diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-06 01:07:23 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-06 01:07:23 +0000 |
commit | a43eff3d6efec6cbaf0863d390dc9b4bd58bdaa1 (patch) | |
tree | 23264555f339dadd36935af0c6bac25e9d92d545 /drm/1.0/default/CryptoPlugin.cpp | |
parent | e58dfd999e19e6661e24260b1f7f1d276133cb22 (diff) | |
parent | a98f551aad1c49678c6b52bdbeda0fe1c7626e41 (diff) |
Snap for 7259849 from a98f551aad1c49678c6b52bdbeda0fe1c7626e41 to sc-release
Change-Id: Ic150c0ebad2ea47b6c7fb01d7c07a4a81114050d
Diffstat (limited to 'drm/1.0/default/CryptoPlugin.cpp')
-rw-r--r-- | drm/1.0/default/CryptoPlugin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp index e6d4e8447b..de8bbd599c 100644 --- a/drm/1.0/default/CryptoPlugin.cpp +++ b/drm/1.0/default/CryptoPlugin.cpp @@ -53,6 +53,8 @@ namespace implementation { uint32_t bufferId) { sp<IMemory> hidlMemory = mapMemory(base); + std::lock_guard<std::mutex> shared_buffer_lock(mSharedBufferLock); + // allow mapMemory to return nullptr mSharedBufferMap[bufferId] = hidlMemory; return Void(); @@ -65,7 +67,7 @@ namespace implementation { const SharedBuffer& source, uint64_t offset, const DestinationBuffer& destination, decrypt_cb _hidl_cb) { - + std::unique_lock<std::mutex> shared_buffer_lock(mSharedBufferLock); if (mSharedBufferMap.find(source.bufferId) == mSharedBufferMap.end()) { _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "source decrypt buffer base not set"); return Void(); @@ -79,7 +81,7 @@ namespace implementation { } } - android::CryptoPlugin::Mode legacyMode; + android::CryptoPlugin::Mode legacyMode = android::CryptoPlugin::kMode_Unencrypted; switch(mode) { case Mode::UNENCRYPTED: legacyMode = android::CryptoPlugin::kMode_Unencrypted; @@ -170,6 +172,10 @@ namespace implementation { _hidl_cb(Status::BAD_VALUE, 0, "invalid destination type"); return Void(); } + + // release mSharedBufferLock + shared_buffer_lock.unlock(); + ssize_t result = mLegacyPlugin->decrypt(secure, keyId.data(), iv.data(), legacyMode, legacyPattern, srcPtr, legacySubSamples.get(), subSamples.size(), destPtr, &detailMessage); |