summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Mohan M2017-07-04 08:51:19 -0500
committerKeun Soo Yim2018-01-23 16:22:39 -0600
commit56906949cca547f0f1a53144a84aa2b0afff1d68 (patch)
treec114451e4f9ed29326407351a70a35ec25843f1d /media/omx/1.0
parentccc3c36c88db1164a9ea2bb608be127f3bf63255 (diff)
downloadplatform-hardware-interfaces-56906949cca547f0f1a53144a84aa2b0afff1d68.tar.gz
platform-hardware-interfaces-56906949cca547f0f1a53144a84aa2b0afff1d68.tar.xz
platform-hardware-interfaces-56906949cca547f0f1a53144a84aa2b0afff1d68.zip
bug fix: output colorformat configuration fixed
The eColorFormat field in OMX_PARAM_PORTDEFINITIONTYPE structure has no effect on the component. This has to be configured from OMX_VIDEO_PARAM_PORTFORMATTYPE. This is corrected. This color format information is passed to graphic buffer during its allocation Bug: 63796949 Merged-In: I51b1e59631647d1291ecfac373781ac5e5a0ffd5 Change-Id: I51b1e59631647d1291ecfac373781ac5e5a0ffd5 (cherry picked from commit 1441864f4c22ec7ae3fc8dd0e7bd525c45b52f13)
Diffstat (limited to 'media/omx/1.0')
-rw-r--r--[-rwxr-xr-x]media/omx/1.0/vts/functional/common/Android.bp0
-rw-r--r--[-rwxr-xr-x]media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp0
-rw-r--r--media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp222
3 files changed, 178 insertions, 44 deletions
diff --git a/media/omx/1.0/vts/functional/common/Android.bp b/media/omx/1.0/vts/functional/common/Android.bp
index 93251fe8..93251fe8 100755..100644
--- a/media/omx/1.0/vts/functional/common/Android.bp
+++ b/media/omx/1.0/vts/functional/common/Android.bp
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
index 1f67e2b6..1f67e2b6 100755..100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index f13d88c1..d6a16a5c 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -27,6 +27,7 @@
27#include <android/hidl/allocator/1.0/IAllocator.h> 27#include <android/hidl/allocator/1.0/IAllocator.h>
28#include <android/hidl/memory/1.0/IMapper.h> 28#include <android/hidl/memory/1.0/IMapper.h>
29#include <android/hidl/memory/1.0/IMemory.h> 29#include <android/hidl/memory/1.0/IMemory.h>
30#include <cutils/atomic.h>
30 31
31using ::android::hardware::graphics::common::V1_0::BufferUsage; 32using ::android::hardware::graphics::common::V1_0::BufferUsage;
32using ::android::hardware::graphics::common::V1_0::PixelFormat; 33using ::android::hardware::graphics::common::V1_0::PixelFormat;
@@ -47,6 +48,7 @@ using ::android::sp;
47 48
48#include <VtsHalHidlTargetTestBase.h> 49#include <VtsHalHidlTargetTestBase.h>
49#include <getopt.h> 50#include <getopt.h>
51#include <media/hardware/HardwareAPI.h>
50#include <media_hidl_test_common.h> 52#include <media_hidl_test_common.h>
51#include <media_video_hidl_test_common.h> 53#include <media_video_hidl_test_common.h>
52#include <fstream> 54#include <fstream>
@@ -399,7 +401,7 @@ void GetURLForComponent(VideoDecHidlTest::standardComp comp, char* mURL,
399void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex, 401void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
400 android::Vector<BufferInfo>* buffArray, 402 android::Vector<BufferInfo>* buffArray,
401 uint32_t nFrameWidth, uint32_t nFrameHeight, 403 uint32_t nFrameWidth, uint32_t nFrameHeight,
402 int32_t* nStride, uint32_t count) { 404 int32_t* nStride, int format, uint32_t count) {
403 android::hardware::media::omx::V1_0::Status status; 405 android::hardware::media::omx::V1_0::Status status;
404 sp<android::hardware::graphics::allocator::V2_0::IAllocator> allocator = 406 sp<android::hardware::graphics::allocator::V2_0::IAllocator> allocator =
405 android::hardware::graphics::allocator::V2_0::IAllocator::getService(); 407 android::hardware::graphics::allocator::V2_0::IAllocator::getService();
@@ -416,7 +418,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
416 descriptorInfo.width = nFrameWidth; 418 descriptorInfo.width = nFrameWidth;
417 descriptorInfo.height = nFrameHeight; 419 descriptorInfo.height = nFrameHeight;
418 descriptorInfo.layerCount = 1; 420 descriptorInfo.layerCount = 1;
419 descriptorInfo.format = PixelFormat::RGBA_8888; 421 descriptorInfo.format = static_cast<PixelFormat>(format);
420 descriptorInfo.usage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN); 422 descriptorInfo.usage = static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN);
421 omxNode->getGraphicBufferUsage( 423 omxNode->getGraphicBufferUsage(
422 portIndex, 424 portIndex,
@@ -441,6 +443,9 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
441 EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE); 443 EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
442 444
443 EXPECT_EQ(buffArray->size(), count); 445 EXPECT_EQ(buffArray->size(), count);
446
447 static volatile int32_t nextId = 0;
448 uint64_t id = static_cast<uint64_t>(getpid()) << 32;
444 allocator->allocate( 449 allocator->allocate(
445 descriptor, count, 450 descriptor, count,
446 [&](android::hardware::graphics::mapper::V2_0::Error _s, uint32_t _n1, 451 [&](android::hardware::graphics::mapper::V2_0::Error _s, uint32_t _n1,
@@ -464,7 +469,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
464 buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.layerCount = 469 buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.layerCount =
465 descriptorInfo.layerCount; 470 descriptorInfo.layerCount;
466 buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.id = 471 buffArray->editItemAt(i).omxBuffer.attr.anwBuffer.id =
467 (*buffArray)[i].id; 472 id | static_cast<uint32_t>(android_atomic_inc(&nextId));
468 } 473 }
469 }); 474 });
470} 475}
@@ -510,12 +515,15 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
510 515
511 // set Port Params 516 // set Port Params
512 uint32_t nFrameWidth, nFrameHeight, xFramerate; 517 uint32_t nFrameWidth, nFrameHeight, xFramerate;
513 OMX_COLOR_FORMATTYPE eColorFormat =
514 OMX_COLOR_FormatYUV420Planar;
515 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, 518 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth,
516 &nFrameHeight, &xFramerate); 519 &nFrameHeight, &xFramerate);
520 // get configured color format
521 OMX_PARAM_PORTDEFINITIONTYPE portDef;
522 status = getPortParam(omxNode, OMX_IndexParamPortDefinition,
523 kPortIndexOutput, &portDef);
517 setDefaultPortParam(omxNode, kPortIndexOutput, 524 setDefaultPortParam(omxNode, kPortIndexOutput,
518 OMX_VIDEO_CodingUnused, eColorFormat, 525 OMX_VIDEO_CodingUnused,
526 portDef.format.video.eColorFormat,
519 nFrameWidth, nFrameHeight, 0, xFramerate); 527 nFrameWidth, nFrameHeight, 0, xFramerate);
520 528
521 // If you can disable a port, then you should be able to 529 // If you can disable a port, then you should be able to
@@ -547,6 +555,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
547 portDef.format.video.nFrameWidth, 555 portDef.format.video.nFrameWidth,
548 portDef.format.video.nFrameHeight, 556 portDef.format.video.nFrameHeight,
549 &portDef.format.video.nStride, 557 &portDef.format.video.nStride,
558 portDef.format.video.eColorFormat,
550 portDef.nBufferCountActual); 559 portDef.nBufferCountActual);
551 } 560 }
552 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, 561 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
@@ -707,6 +716,116 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
707 } 716 }
708} 717}
709 718
719// DescribeColorFormatParams Copy Constructor (Borrowed from OMXUtils.cpp)
720android::DescribeColorFormatParams::DescribeColorFormatParams(
721 const android::DescribeColorFormat2Params& params) {
722 eColorFormat = params.eColorFormat;
723 nFrameWidth = params.nFrameWidth;
724 nFrameHeight = params.nFrameHeight;
725 nStride = params.nStride;
726 nSliceHeight = params.nSliceHeight;
727 bUsingNativeBuffers = params.bUsingNativeBuffers;
728};
729
730bool isColorFormatFlexibleYUV(sp<IOmxNode> omxNode,
731 OMX_COLOR_FORMATTYPE eColorFormat) {
732 android::hardware::media::omx::V1_0::Status status;
733 unsigned int index = OMX_IndexMax, index2 = OMX_IndexMax;
734 omxNode->getExtensionIndex(
735 "OMX.google.android.index.describeColorFormat",
736 [&index](android::hardware::media::omx::V1_0::Status _s,
737 unsigned int _nl) {
738 if (_s == ::android::hardware::media::omx::V1_0::Status::OK)
739 index = _nl;
740 });
741 omxNode->getExtensionIndex(
742 "OMX.google.android.index.describeColorFormat2",
743 [&index2](android::hardware::media::omx::V1_0::Status _s,
744 unsigned int _nl) {
745 if (_s == ::android::hardware::media::omx::V1_0::Status::OK)
746 index2 = _nl;
747 });
748
749 android::DescribeColorFormat2Params describeParams;
750 describeParams.eColorFormat = eColorFormat;
751 describeParams.nFrameWidth = 128;
752 describeParams.nFrameHeight = 128;
753 describeParams.nStride = 128;
754 describeParams.nSliceHeight = 128;
755 describeParams.bUsingNativeBuffers = OMX_FALSE;
756 if (index != OMX_IndexMax) {
757 android::DescribeColorFormatParams describeParamsV1(describeParams);
758 status = getParam(omxNode, static_cast<OMX_INDEXTYPE>(index),
759 &describeParamsV1);
760 if (status == ::android::hardware::media::omx::V1_0::Status::OK) {
761 android::MediaImage& img = describeParamsV1.sMediaImage;
762 if (img.mType == android::MediaImage::MEDIA_IMAGE_TYPE_YUV) {
763 if (img.mNumPlanes == 3 &&
764 img.mPlane[img.Y].mHorizSubsampling == 1 &&
765 img.mPlane[img.Y].mVertSubsampling == 1) {
766 if (img.mPlane[img.U].mHorizSubsampling == 2 &&
767 img.mPlane[img.U].mVertSubsampling == 2 &&
768 img.mPlane[img.V].mHorizSubsampling == 2 &&
769 img.mPlane[img.V].mVertSubsampling == 2) {
770 if (img.mBitDepth <= 8) {
771 return true;
772 }
773 }
774 }
775 }
776 }
777 } else if (index2 != OMX_IndexMax) {
778 status = getParam(omxNode, static_cast<OMX_INDEXTYPE>(index2),
779 &describeParams);
780 android::MediaImage2& img = describeParams.sMediaImage;
781 if (img.mType == android::MediaImage2::MEDIA_IMAGE_TYPE_YUV) {
782 if (img.mNumPlanes == 3 &&
783 img.mPlane[img.Y].mHorizSubsampling == 1 &&
784 img.mPlane[img.Y].mVertSubsampling == 1) {
785 if (img.mPlane[img.U].mHorizSubsampling == 2 &&
786 img.mPlane[img.U].mVertSubsampling == 2 &&
787 img.mPlane[img.V].mHorizSubsampling == 2 &&
788 img.mPlane[img.V].mVertSubsampling == 2) {
789 if (img.mBitDepth <= 8) {
790 return true;
791 }
792 }
793 }
794 }
795 }
796 return false;
797}
798
799// get default color format for output port
800void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput,
801 PortMode oPortMode,
802 OMX_COLOR_FORMATTYPE* eColorFormat) {
803 android::hardware::media::omx::V1_0::Status status;
804 OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat;
805 *eColorFormat = OMX_COLOR_FormatUnused;
806 portFormat.nIndex = 0;
807 while (1) {
808 status = getPortParam(omxNode, OMX_IndexParamVideoPortFormat,
809 kPortIndexOutput, &portFormat);
810 if (status != ::android::hardware::media::omx::V1_0::Status::OK) break;
811 EXPECT_EQ(portFormat.eCompressionFormat, OMX_VIDEO_CodingUnused);
812 if (oPortMode != PortMode::PRESET_BYTE_BUFFER) {
813 *eColorFormat = portFormat.eColorFormat;
814 break;
815 }
816 if (isColorFormatFlexibleYUV(omxNode, portFormat.eColorFormat)) {
817 *eColorFormat = portFormat.eColorFormat;
818 break;
819 }
820 if (OMX_COLOR_FormatYUV420SemiPlanar == portFormat.eColorFormat ||
821 OMX_COLOR_FormatYUV420Planar == portFormat.eColorFormat) {
822 *eColorFormat = portFormat.eColorFormat;
823 break;
824 }
825 portFormat.nIndex++;
826 }
827}
828
710// set component role 829// set component role
711TEST_F(VideoDecHidlTest, SetRole) { 830TEST_F(VideoDecHidlTest, SetRole) {
712 description("Test Set Component Role"); 831 description("Test Set Component Role");
@@ -802,9 +921,17 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
802 921
803 // set Port Params 922 // set Port Params
804 uint32_t nFrameWidth, nFrameHeight, xFramerate; 923 uint32_t nFrameWidth, nFrameHeight, xFramerate;
805 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
806 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, 924 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight,
807 &xFramerate); 925 &xFramerate);
926 // get default color format
927 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused;
928 getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1],
929 &eColorFormat);
930 ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused);
931 status =
932 setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
933 eColorFormat, xFramerate);
934 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
808 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, 935 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
809 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); 936 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
810 937
@@ -828,7 +955,8 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
828 allocateGraphicBuffers( 955 allocateGraphicBuffers(
829 omxNode, kPortIndexOutput, &oBuffer, 956 omxNode, kPortIndexOutput, &oBuffer,
830 portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight, 957 portDef.format.video.nFrameWidth, portDef.format.video.nFrameHeight,
831 &portDef.format.video.nStride, portDef.nBufferCountActual); 958 &portDef.format.video.nStride, portDef.format.video.eColorFormat,
959 portDef.nBufferCountActual);
832 } 960 }
833 961
834 // Port Reconfiguration 962 // Port Reconfiguration
@@ -866,22 +994,28 @@ TEST_F(VideoDecHidlTest, EOSTest_M) {
866 kPortIndexOutput = kPortIndexInput + 1; 994 kPortIndexOutput = kPortIndexInput + 1;
867 } 995 }
868 996
997 // set port mode
998 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
999 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1000 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
1001 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1002
869 // set Port Params 1003 // set Port Params
870 uint32_t nFrameWidth, nFrameHeight, xFramerate; 1004 uint32_t nFrameWidth, nFrameHeight, xFramerate;
871 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
872 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, 1005 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight,
873 &xFramerate); 1006 &xFramerate);
1007 // get default color format
1008 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused;
1009 getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1],
1010 &eColorFormat);
1011 ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused);
1012 status =
1013 setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1014 eColorFormat, xFramerate);
1015 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
874 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, 1016 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
875 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); 1017 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
876 1018
877 // set port mode
878 PortMode portMode[2];
879 portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
880 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
881 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
882 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
883 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
884
885 android::Vector<BufferInfo> iBuffer, oBuffer; 1019 android::Vector<BufferInfo> iBuffer, oBuffer;
886 1020
887 // set state to idle 1021 // set state to idle
@@ -956,20 +1090,20 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) {
956 1090
957 // set Port Params 1091 // set Port Params
958 uint32_t nFrameWidth, nFrameHeight, xFramerate; 1092 uint32_t nFrameWidth, nFrameHeight, xFramerate;
959 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
960 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, 1093 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight,
961 &xFramerate); 1094 &xFramerate);
1095 // get default color format
1096 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused;
1097 getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1],
1098 &eColorFormat);
1099 ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused);
1100 status =
1101 setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1102 eColorFormat, xFramerate);
1103 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
962 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, 1104 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
963 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); 1105 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
964 1106
965 // set port mode
966 PortMode portMode[2];
967 portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
968 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
969 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
970 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
971 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
972
973 android::Vector<BufferInfo> iBuffer, oBuffer; 1107 android::Vector<BufferInfo> iBuffer, oBuffer;
974 1108
975 // set state to idle 1109 // set state to idle
@@ -1069,20 +1203,20 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
1069 1203
1070 // set Port Params 1204 // set Port Params
1071 uint32_t nFrameWidth, nFrameHeight, xFramerate; 1205 uint32_t nFrameWidth, nFrameHeight, xFramerate;
1072 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
1073 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, 1206 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight,
1074 &xFramerate); 1207 &xFramerate);
1208 // get default color format
1209 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused;
1210 getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1],
1211 &eColorFormat);
1212 ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused);
1213 status =
1214 setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1215 eColorFormat, xFramerate);
1216 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1075 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, 1217 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1076 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); 1218 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
1077 1219
1078 // set port mode
1079 PortMode portMode[2];
1080 portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
1081 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
1082 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1083 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
1084 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1085
1086 android::Vector<BufferInfo> iBuffer, oBuffer; 1220 android::Vector<BufferInfo> iBuffer, oBuffer;
1087 1221
1088 // set state to idle 1222 // set state to idle
@@ -1164,20 +1298,20 @@ TEST_F(VideoDecHidlTest, FlushTest) {
1164 1298
1165 // set Port Params 1299 // set Port Params
1166 uint32_t nFrameWidth, nFrameHeight, xFramerate; 1300 uint32_t nFrameWidth, nFrameHeight, xFramerate;
1167 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar;
1168 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, 1301 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight,
1169 &xFramerate); 1302 &xFramerate);
1303 // get default color format
1304 OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused;
1305 getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1],
1306 &eColorFormat);
1307 ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused);
1308 status =
1309 setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1310 eColorFormat, xFramerate);
1311 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1170 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, 1312 setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused,
1171 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); 1313 eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate);
1172 1314
1173 // set port mode
1174 PortMode portMode[2];
1175 portMode[0] = portMode[1] = PortMode::PRESET_BYTE_BUFFER;
1176 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
1177 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1178 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
1179 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1180
1181 android::Vector<BufferInfo> iBuffer, oBuffer; 1315 android::Vector<BufferInfo> iBuffer, oBuffer;
1182 1316
1183 // set state to idle 1317 // set state to idle