summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r--media/libstagefright/MediaCodec.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index c36dd7c..c4c47b3 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -746,6 +746,10 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
CHECK(msg->findInt32("width", &width));
CHECK(msg->findInt32("height", &height));
+ int32_t cropLeft, cropTop, cropRight, cropBottom;
+ CHECK(msg->findRect("crop",
+ &cropLeft, &cropTop, &cropRight, &cropBottom));
+
int32_t colorFormat;
CHECK(msg->findInt32(
"color-format", &colorFormat));
@@ -753,6 +757,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
sp<MetaData> meta = new MetaData;
meta->setInt32(kKeyWidth, width);
meta->setInt32(kKeyHeight, height);
+ meta->setRect(kKeyCropRect,
+ cropLeft, cropTop, cropRight, cropBottom);
meta->setInt32(kKeyColorFormat, colorFormat);
mSoftRenderer =
@@ -1674,7 +1680,7 @@ status_t MediaCodec::onReleaseOutputBuffer(const sp<AMessage> &msg) {
return -EACCES;
}
- if (render && (info->mData == NULL || info->mData->size() != 0)) {
+ if (render && info->mData != NULL && info->mData->size() != 0) {
info->mNotify->setInt32("render", true);
if (mSoftRenderer != NULL) {