diff options
| author | Jeff Tinker <jtinker@google.com> | 2017-03-15 23:41:23 -0700 |
|---|---|---|
| committer | Jeff Tinker <jtinker@google.com> | 2017-03-17 11:33:24 -0700 |
| commit | 33327c7f0f04bcce3f8e8ee23953f87efc423037 (patch) | |
| tree | 2e3f8e0de5d2ad4a8d5e87c5ffa1d770e2041c49 /drm/libmediadrm/ICrypto.cpp | |
| parent | d0cb831e7f14c43359aeb080d9564185d28c7a75 (diff) | |
| download | frameworks_av-33327c7f0f04bcce3f8e8ee23953f87efc423037.tar.gz frameworks_av-33327c7f0f04bcce3f8e8ee23953f87efc423037.tar.bz2 frameworks_av-33327c7f0f04bcce3f8e8ee23953f87efc423037.zip | |
Fix decoder instantiation during playback
When a decoder is created while another decoder
is in use and the two decoders share a common
crypto instance, decryption results would become
indeterminate, which could cause the decoder to
hang. This change adds a notification to the
crypto instance so it can update state when its
ownership changes.
bug: 36209723
Test: playbacktests-debug-androidTest.apk as
described in the bug.
Change-Id: I453c260eace5543dd79a3569bf6a9592394c4113
Diffstat (limited to 'drm/libmediadrm/ICrypto.cpp')
| -rw-r--r-- | drm/libmediadrm/ICrypto.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drm/libmediadrm/ICrypto.cpp b/drm/libmediadrm/ICrypto.cpp index 49a2d3e8f8..6b42ff0cca 100644 --- a/drm/libmediadrm/ICrypto.cpp +++ b/drm/libmediadrm/ICrypto.cpp @@ -36,6 +36,8 @@ enum { DECRYPT, NOTIFY_RESOLUTION, SET_MEDIADRM_SESSION, + SET_HEAP, + UNSET_HEAP, }; struct BpCrypto : public BpInterface<ICrypto> { @@ -177,6 +179,23 @@ struct BpCrypto : public BpInterface<ICrypto> { return reply.readInt32(); } + virtual void setHeap(const sp<IMemoryHeap> &heap) { + Parcel data, reply; + data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); + data.writeStrongBinder(IInterface::asBinder(heap)); + remote()->transact(SET_HEAP, data, &reply); + return; + } + + virtual void unsetHeap(const sp<IMemoryHeap>& heap) { + Parcel data, reply; + data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); + data.writeStrongBinder(IInterface::asBinder(heap)); + remote()->transact(UNSET_HEAP, data, &reply); + return; + } + + private: void readVector(Parcel &reply, Vector<uint8_t> &vector) const { uint32_t size = reply.readInt32(); @@ -400,6 +419,24 @@ status_t BnCrypto::onTransact( return OK; } + case SET_HEAP: + { + CHECK_INTERFACE(ICrypto, data, reply); + sp<IMemoryHeap> heap = + interface_cast<IMemoryHeap>(data.readStrongBinder()); + setHeap(heap); + return OK; + } + + case UNSET_HEAP: + { + CHECK_INTERFACE(ICrypto, data, reply); + sp<IMemoryHeap> heap = + interface_cast<IMemoryHeap>(data.readStrongBinder()); + unsetHeap(heap); + return OK; + } + default: return BBinder::onTransact(code, data, reply, flags); } |
