summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/Utils.cpp
diff options
context:
space:
mode:
authorRonghua Wu <ronghuawu@google.com>2014-08-08 15:24:55 -0700
committerLajos Molnar <lajos@google.com>2014-08-15 20:28:35 +0000
commit475da7ef08c05a482ced8d318832cf5aa1141aff (patch)
tree3c4e98f28f30294b9aa19278ad5c292610647075 /media/libstagefright/Utils.cpp
parent426c719a5f3b4d88480eb35a7b0b373f672ea3cb (diff)
downloadframeworks_av-475da7ef08c05a482ced8d318832cf5aa1141aff.zip
frameworks_av-475da7ef08c05a482ced8d318832cf5aa1141aff.tar.gz
frameworks_av-475da7ef08c05a482ced8d318832cf5aa1141aff.tar.bz2
stagefright: Fix race condition between MediaCodec and SoftwareRenderer
* Set the buffer's format info when it's returned from OMX component. * Move frame format meta from SoftwareRenderer's ctor to the render call. I.e. each frame sent to the renderer carries the format info. * Reset renderer with the new format instead of re-creating SoftwareRenderer when incoming frame's format is changed. Bug: 13842676 Change-Id: Ibab46f109200bcbdeab13a4cc1bcd0870f2a99fb
Diffstat (limited to 'media/libstagefright/Utils.cpp')
-rw-r--r--media/libstagefright/Utils.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index 5f1d1c6..25afc5b 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -109,6 +109,25 @@ status_t convertMetaDataToMessage(
msg->setInt32("sar-width", sarWidth);
msg->setInt32("sar-height", sarHeight);
}
+
+ int32_t colorFormat;
+ if (meta->findInt32(kKeyColorFormat, &colorFormat)) {
+ msg->setInt32("color-format", colorFormat);
+ }
+
+ int32_t cropLeft, cropTop, cropRight, cropBottom;
+ if (meta->findRect(kKeyCropRect,
+ &cropLeft,
+ &cropTop,
+ &cropRight,
+ &cropBottom)) {
+ msg->setRect("crop", cropLeft, cropTop, cropRight, cropBottom);
+ }
+
+ int32_t rotationDegrees;
+ if (meta->findInt32(kKeyRotation, &rotationDegrees)) {
+ msg->setInt32("rotation-degrees", rotationDegrees);
+ }
} else if (!strncasecmp("audio/", mime, 6)) {
int32_t numChannels, sampleRate;
CHECK(meta->findInt32(kKeyChannelCount, &numChannels));
@@ -475,6 +494,25 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
meta->setInt32(kKeySARWidth, sarWidth);
meta->setInt32(kKeySARHeight, sarHeight);
}
+
+ int32_t colorFormat;
+ if (msg->findInt32("color-format", &colorFormat)) {
+ meta->setInt32(kKeyColorFormat, colorFormat);
+ }
+
+ int32_t cropLeft, cropTop, cropRight, cropBottom;
+ if (msg->findRect("crop",
+ &cropLeft,
+ &cropTop,
+ &cropRight,
+ &cropBottom)) {
+ meta->setRect(kKeyCropRect, cropLeft, cropTop, cropRight, cropBottom);
+ }
+
+ int32_t rotationDegrees;
+ if (msg->findInt32("rotation-degrees", &rotationDegrees)) {
+ meta->setInt32(kKeyRotation, rotationDegrees);
+ }
} else if (mime.startsWith("audio/")) {
int32_t numChannels;
if (msg->findInt32("channel-count", &numChannels)) {