merge in jb-release history after reset to jb-dev
diff --git a/include/media/ICrypto.h b/include/media/ICrypto.h
index 61059bd..32a2cf7 100644
--- a/include/media/ICrypto.h
+++ b/include/media/ICrypto.h
@@ -41,7 +41,7 @@
virtual bool requiresSecureDecoderComponent(
const char *mime) const = 0;
- virtual ssize_t decrypt(
+ virtual status_t decrypt(
bool secure,
const uint8_t key[16],
const uint8_t iv[16],
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 2defc2d..3452e5c 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -91,7 +91,7 @@
return reply.readInt32() != 0;
}
- virtual ssize_t decrypt(
+ virtual status_t decrypt(
bool secure,
const uint8_t key[16],
const uint8_t iv[16],
@@ -136,17 +136,21 @@
remote()->transact(DECRYPT, data, &reply);
- ssize_t result = reply.readInt32();
+ status_t result = reply.readInt32();
if (result >= ERROR_DRM_VENDOR_MIN && result <= ERROR_DRM_VENDOR_MAX) {
errorDetailMsg->setTo(reply.readCString());
}
- if (!secure && result >= 0) {
- reply.read(dstPtr, result);
+ if (result != OK) {
+ return result;
}
- return result;
+ if (!secure) {
+ reply.read(dstPtr, totalSize);
+ }
+
+ return OK;
}
private:
@@ -255,7 +259,8 @@
}
AString errorDetailMsg;
- ssize_t result = decrypt(
+
+ status_t err = decrypt(
secure,
key,
iv,
@@ -265,18 +270,18 @@
dstPtr,
&errorDetailMsg);
- reply->writeInt32(result);
+ reply->writeInt32(err);
- if (result >= ERROR_DRM_VENDOR_MIN
- && result <= ERROR_DRM_VENDOR_MAX) {
+ if (err >= ERROR_DRM_VENDOR_MIN
+ && err <= ERROR_DRM_VENDOR_MAX) {
reply->writeCString(errorDetailMsg.c_str());
}
if (!secure) {
- if (result >= 0) {
- CHECK_LE(result, static_cast<ssize_t>(totalSize));
- reply->write(dstPtr, result);
+ if (err == OK) {
+ reply->write(dstPtr, totalSize);
}
+
free(dstPtr);
dstPtr = NULL;
}
diff --git a/media/libmediaplayerservice/Crypto.cpp b/media/libmediaplayerservice/Crypto.cpp
index 0e8f913..d35d5b1 100644
--- a/media/libmediaplayerservice/Crypto.cpp
+++ b/media/libmediaplayerservice/Crypto.cpp
@@ -141,7 +141,7 @@
return mPlugin->requiresSecureDecoderComponent(mime);
}
-ssize_t Crypto::decrypt(
+status_t Crypto::decrypt(
bool secure,
const uint8_t key[16],
const uint8_t iv[16],
diff --git a/media/libmediaplayerservice/Crypto.h b/media/libmediaplayerservice/Crypto.h
index d066774..c5aa3c6 100644
--- a/media/libmediaplayerservice/Crypto.h
+++ b/media/libmediaplayerservice/Crypto.h
@@ -42,7 +42,7 @@
virtual bool requiresSecureDecoderComponent(
const char *mime) const;
- virtual ssize_t decrypt(
+ virtual status_t decrypt(
bool secure,
const uint8_t key[16],
const uint8_t iv[16],
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 67f5a22..ff71170 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1346,7 +1346,7 @@
AString *errorDetailMsg;
CHECK(msg->findPointer("errorDetailMsg", (void **)&errorDetailMsg));
- ssize_t result = mCrypto->decrypt(
+ status_t err = mCrypto->decrypt(
(mFlags & kFlagIsSecure) != 0,
key,
iv,
@@ -1357,11 +1357,11 @@
info->mData->base(),
errorDetailMsg);
- if (result < 0) {
- return result;
+ if (err != OK) {
+ return err;
}
- info->mData->setRange(0, result);
+ info->mData->setRange(0, size);
}
reply->setBuffer("buffer", info->mData);