Merge "ACodec: query grid config from component even if grid is disabled"
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 3d67c91..d198d39 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -4505,22 +4505,38 @@
status_t ACodec::configureImageGrid(
const sp<AMessage> &msg, sp<AMessage> &outputFormat) {
int32_t tileWidth, tileHeight, gridRows, gridCols;
- if (!msg->findInt32("tile-width", &tileWidth) ||
- !msg->findInt32("tile-height", &tileHeight) ||
- !msg->findInt32("grid-rows", &gridRows) ||
- !msg->findInt32("grid-cols", &gridCols)) {
+ OMX_BOOL useGrid = OMX_FALSE;
+ if (msg->findInt32("tile-width", &tileWidth) &&
+ msg->findInt32("tile-height", &tileHeight) &&
+ msg->findInt32("grid-rows", &gridRows) &&
+ msg->findInt32("grid-cols", &gridCols)) {
+ useGrid = OMX_TRUE;
+ } else {
+ // when bEnabled is false, the tile info is not used,
+ // but clear out these too.
+ tileWidth = tileHeight = gridRows = gridCols = 0;
+ }
+
+ if (!mIsImage && !useGrid) {
return OK;
}
OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE gridType;
InitOMXParams(&gridType);
gridType.nPortIndex = kPortIndexOutput;
- gridType.bEnabled = OMX_TRUE;
+ gridType.bEnabled = useGrid;
gridType.nTileWidth = tileWidth;
gridType.nTileHeight = tileHeight;
gridType.nGridRows = gridRows;
gridType.nGridCols = gridCols;
+ ALOGV("sending image grid info to component: bEnabled %d, tile %dx%d, grid %dx%d",
+ gridType.bEnabled,
+ gridType.nTileWidth,
+ gridType.nTileHeight,
+ gridType.nGridRows,
+ gridType.nGridCols);
+
status_t err = mOMXNode->setParameter(
(OMX_INDEXTYPE)OMX_IndexParamVideoAndroidImageGrid,
&gridType, sizeof(gridType));
@@ -4541,6 +4557,13 @@
(OMX_INDEXTYPE)OMX_IndexParamVideoAndroidImageGrid,
&gridType, sizeof(gridType));
+ ALOGV("received image grid info from component: bEnabled %d, tile %dx%d, grid %dx%d",
+ gridType.bEnabled,
+ gridType.nTileWidth,
+ gridType.nTileHeight,
+ gridType.nGridRows,
+ gridType.nGridCols);
+
if (err == OK && gridType.bEnabled) {
outputFormat->setInt32("tile-width", gridType.nTileWidth);
outputFormat->setInt32("tile-height", gridType.nTileHeight);