Support multiple codecs per crypto instance
The initial drm hidl hal implementation assumed one
codec per crypto instance, but in fact there can be
multiple codecs per crypto instance. This change
extends the drm hal to allow multiple memory heaps
per crypto plugin. It fixes the issue of mapping
memory frequently during playback.
bug:35275191
Test: manual verification with Play Movies on angler
and in binderized mode on marlin
Change-Id: I0ec36856248623d2ad8acb8ce9873e9274883a40
diff --git a/drm/1.0/default/CryptoPlugin.h b/drm/1.0/default/CryptoPlugin.h
index f805f09..11cc2aa 100644
--- a/drm/1.0/default/CryptoPlugin.h
+++ b/drm/1.0/default/CryptoPlugin.h
@@ -57,8 +57,8 @@
Return<Status> setMediaDrmSession(const hidl_vec<uint8_t>& sessionId)
override;
- Return<void> setSharedBufferBase(const ::android::hardware::hidl_memory& base)
- override;
+ Return<void> setSharedBufferBase(const ::android::hardware::hidl_memory& base,
+ uint32_t bufferId) override;
Return<void> decrypt(bool secure, const hidl_array<uint8_t, 16>& keyId,
const hidl_array<uint8_t, 16>& iv, Mode mode, const Pattern& pattern,
@@ -68,7 +68,7 @@
private:
android::CryptoPlugin *mLegacyPlugin;
- sp<IMemory> mSharedBufferBase;
+ std::map<uint32_t, sp<IMemory> > mSharedBufferMap;
CryptoPlugin() = delete;
CryptoPlugin(const CryptoPlugin &) = delete;