diff options
author | Edwin Wong <edwinwong@google.com> | 2012-07-10 20:01:13 -0700 |
---|---|---|
committer | Edwin Wong <edwinwong@google.com> | 2012-07-13 13:05:56 -0700 |
commit | fa2b8f243eb048fb2b8e5a14356190f69eb31a36 (patch) | |
tree | d54232d4c61bf767677bcee2373069c4969301c1 /media/libmedia | |
parent | 4221e2813f7a307936036e62b6a63bbda23005ee (diff) | |
download | frameworks_av-fa2b8f243eb048fb2b8e5a14356190f69eb31a36.zip frameworks_av-fa2b8f243eb048fb2b8e5a14356190f69eb31a36.tar.gz frameworks_av-fa2b8f243eb048fb2b8e5a14356190f69eb31a36.tar.bz2 |
Fixed sample video corrupted in MediaCodec mode.
Change-Id: I50c5660072d40f6e297e58fd026ea04c89d6a70a
related-to-bug: 6732061
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/ICrypto.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp index 3452e5c..2defc2d 100644 --- a/media/libmedia/ICrypto.cpp +++ b/media/libmedia/ICrypto.cpp @@ -91,7 +91,7 @@ struct BpCrypto : public BpInterface<ICrypto> { return reply.readInt32() != 0; } - virtual status_t decrypt( + virtual ssize_t decrypt( bool secure, const uint8_t key[16], const uint8_t iv[16], @@ -136,21 +136,17 @@ struct BpCrypto : public BpInterface<ICrypto> { remote()->transact(DECRYPT, data, &reply); - status_t result = reply.readInt32(); + ssize_t result = reply.readInt32(); if (result >= ERROR_DRM_VENDOR_MIN && result <= ERROR_DRM_VENDOR_MAX) { errorDetailMsg->setTo(reply.readCString()); } - if (result != OK) { - return result; + if (!secure && result >= 0) { + reply.read(dstPtr, result); } - if (!secure) { - reply.read(dstPtr, totalSize); - } - - return OK; + return result; } private: @@ -259,8 +255,7 @@ status_t BnCrypto::onTransact( } AString errorDetailMsg; - - status_t err = decrypt( + ssize_t result = decrypt( secure, key, iv, @@ -270,18 +265,18 @@ status_t BnCrypto::onTransact( dstPtr, &errorDetailMsg); - reply->writeInt32(err); + reply->writeInt32(result); - if (err >= ERROR_DRM_VENDOR_MIN - && err <= ERROR_DRM_VENDOR_MAX) { + if (result >= ERROR_DRM_VENDOR_MIN + && result <= ERROR_DRM_VENDOR_MAX) { reply->writeCString(errorDetailMsg.c_str()); } if (!secure) { - if (err == OK) { - reply->write(dstPtr, totalSize); + if (result >= 0) { + CHECK_LE(result, static_cast<ssize_t>(totalSize)); + reply->write(dstPtr, result); } - free(dstPtr); dstPtr = NULL; } |