frameworks/av
リビジョン | 97390c6bf23326a0d9a97b9d63e7f72eab396303 (tree) |
---|---|
日時 | 2019-09-05 10:40:56 |
作者 | Chong Zhang <chz@goog...> |
コミッター | Chong Zhang |
ACodec: query grid config from component even if grid is disabled
bug: 138397508
test: cts HeifWriterTest on devices that can enable OMX HEIC encoder.
Change-Id: I6e8437c0b8cc4901e943f2ed7cb23cb16ed096fe
(cherry picked from commit 7b0ff1953ddeee2e83c8f8871cdf69db3ac32c85)
@@ -4505,22 +4505,38 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) { | ||
4505 | 4505 | status_t ACodec::configureImageGrid( |
4506 | 4506 | const sp<AMessage> &msg, sp<AMessage> &outputFormat) { |
4507 | 4507 | int32_t tileWidth, tileHeight, gridRows, gridCols; |
4508 | - if (!msg->findInt32("tile-width", &tileWidth) || | |
4509 | - !msg->findInt32("tile-height", &tileHeight) || | |
4510 | - !msg->findInt32("grid-rows", &gridRows) || | |
4511 | - !msg->findInt32("grid-cols", &gridCols)) { | |
4508 | + OMX_BOOL useGrid = OMX_FALSE; | |
4509 | + if (msg->findInt32("tile-width", &tileWidth) && | |
4510 | + msg->findInt32("tile-height", &tileHeight) && | |
4511 | + msg->findInt32("grid-rows", &gridRows) && | |
4512 | + msg->findInt32("grid-cols", &gridCols)) { | |
4513 | + useGrid = OMX_TRUE; | |
4514 | + } else { | |
4515 | + // when bEnabled is false, the tile info is not used, | |
4516 | + // but clear out these too. | |
4517 | + tileWidth = tileHeight = gridRows = gridCols = 0; | |
4518 | + } | |
4519 | + | |
4520 | + if (!mIsImage && !useGrid) { | |
4512 | 4521 | return OK; |
4513 | 4522 | } |
4514 | 4523 | |
4515 | 4524 | OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE gridType; |
4516 | 4525 | InitOMXParams(&gridType); |
4517 | 4526 | gridType.nPortIndex = kPortIndexOutput; |
4518 | - gridType.bEnabled = OMX_TRUE; | |
4527 | + gridType.bEnabled = useGrid; | |
4519 | 4528 | gridType.nTileWidth = tileWidth; |
4520 | 4529 | gridType.nTileHeight = tileHeight; |
4521 | 4530 | gridType.nGridRows = gridRows; |
4522 | 4531 | gridType.nGridCols = gridCols; |
4523 | 4532 | |
4533 | + ALOGV("sending image grid info to component: bEnabled %d, tile %dx%d, grid %dx%d", | |
4534 | + gridType.bEnabled, | |
4535 | + gridType.nTileWidth, | |
4536 | + gridType.nTileHeight, | |
4537 | + gridType.nGridRows, | |
4538 | + gridType.nGridCols); | |
4539 | + | |
4524 | 4540 | status_t err = mOMXNode->setParameter( |
4525 | 4541 | (OMX_INDEXTYPE)OMX_IndexParamVideoAndroidImageGrid, |
4526 | 4542 | &gridType, sizeof(gridType)); |
@@ -4541,6 +4557,13 @@ status_t ACodec::configureImageGrid( | ||
4541 | 4557 | (OMX_INDEXTYPE)OMX_IndexParamVideoAndroidImageGrid, |
4542 | 4558 | &gridType, sizeof(gridType)); |
4543 | 4559 | |
4560 | + ALOGV("received image grid info from component: bEnabled %d, tile %dx%d, grid %dx%d", | |
4561 | + gridType.bEnabled, | |
4562 | + gridType.nTileWidth, | |
4563 | + gridType.nTileHeight, | |
4564 | + gridType.nGridRows, | |
4565 | + gridType.nGridCols); | |
4566 | + | |
4544 | 4567 | if (err == OK && gridType.bEnabled) { |
4545 | 4568 | outputFormat->setInt32("tile-width", gridType.nTileWidth); |
4546 | 4569 | outputFormat->setInt32("tile-height", gridType.nTileHeight); |