From: Ram Mohan M Date: Wed, 28 Jun 2017 12:50:03 +0000 (+0530) Subject: Add adaptive playback test X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fhardware-interfaces.git;a=commitdiff_plain;h=05f81e4d07383933cc6803796f2d19ab80dce3b3 Add adaptive playback test Test: make vts -j99 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 \ && vts-tradefed run commandAndExit vts \ --skip-all-system-status-check --primary-abi-only \ --skip-preconditions --module VtsHalMediaOmxV1_0Host \ -l INFO Bug: 63796949 Change-Id: I96f19946edb9a333776a60fa2c159dad67801b27 --- diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h index 94a0194d..71012b3b 100644 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h @@ -133,6 +133,7 @@ struct CodecObserver : public IOmxObserver { if (it->type == android::hardware::media::omx::V1_0::Message::Type::EVENT) { *msg = *it; + if (callBack) callBack(*it, nullptr); it = msgQueue.erase(it); // OMX_EventBufferFlag event is sent when the component has // processed a buffer with its EOS flag set. This event is 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 a5b5524b..fb02cd46 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp @@ -219,6 +219,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { timestampUs = 0; timestampDevTest = false; isSecure = false; + portSettingsChange = false; size_t suffixLen = strlen(".secure"); if (strlen(gEnv->getComponent().c_str()) >= suffixLen) { isSecure = @@ -295,6 +296,13 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { } #endif } + } else if (msg.type == Message::Type::EVENT) { + if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { + if ((msg.data.eventData.data2 == OMX_IndexParamPortDefinition || + msg.data.eventData.data2 == 0)) { + portSettingsChange = true; + } + } } } @@ -322,6 +330,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { ::android::List timestampUslist; bool timestampDevTest; bool isSecure; + bool portSettingsChange; protected: static void description(const std::string& description) { @@ -369,41 +378,56 @@ void getInputChannelInfo(sp omxNode, OMX_U32 kPortIndexInput, } } +// number of elementary streams per component +#define STREAM_COUNT 2 // LookUpTable of clips and metadata for component testing void GetURLForComponent(VideoDecHidlTest::standardComp comp, char* mURL, - char* info) { + char* info, size_t streamIndex = 1) { struct CompToURL { VideoDecHidlTest::standardComp comp; - const char* mURL; - const char* info; + const char mURL[STREAM_COUNT][512]; + const char info[STREAM_COUNT][512]; }; + ASSERT_TRUE(streamIndex < STREAM_COUNT); + static const CompToURL kCompToURL[] = { {VideoDecHidlTest::standardComp::avc, - "bbb_avc_1920x1080_5000kbps_30fps.h264", - "bbb_avc_1920x1080_5000kbps_30fps.info"}, + {"bbb_avc_176x144_300kbps_60fps.h264", + "bbb_avc_1920x1080_5000kbps_30fps.h264"}, + {"bbb_avc_176x144_300kbps_60fps.info", + "bbb_avc_1920x1080_5000kbps_30fps.info"}}, {VideoDecHidlTest::standardComp::hevc, - "bbb_hevc_640x360_1600kbps_30fps.hevc", - "bbb_hevc_640x360_1600kbps_30fps.info"}, + {"bbb_hevc_176x144_176kbps_60fps.hevc", + "bbb_hevc_640x360_1600kbps_30fps.hevc"}, + {"bbb_hevc_176x144_176kbps_60fps.info", + "bbb_hevc_640x360_1600kbps_30fps.info"}}, {VideoDecHidlTest::standardComp::mpeg2, - "bbb_mpeg2_176x144_105kbps_25fps.m2v", - "bbb_mpeg2_176x144_105kbps_25fps.info"}, + {"bbb_mpeg2_176x144_105kbps_25fps.m2v", + "bbb_mpeg2_352x288_1mbps_60fps.m2v"}, + {"bbb_mpeg2_176x144_105kbps_25fps.info", + "bbb_mpeg2_352x288_1mbps_60fps.info"}}, {VideoDecHidlTest::standardComp::h263, - "bbb_h263_352x288_300kbps_12fps.h263", - "bbb_h263_352x288_300kbps_12fps.info"}, + {"", "bbb_h263_352x288_300kbps_12fps.h263"}, + {"", "bbb_h263_352x288_300kbps_12fps.info"}}, {VideoDecHidlTest::standardComp::mpeg4, - "bbb_mpeg4_1280x720_1000kbps_25fps.m4v", - "bbb_mpeg4_1280x720_1000kbps_25fps.info"}, - {VideoDecHidlTest::standardComp::vp8, "bbb_vp8_640x360_2mbps_30fps.vp8", - "bbb_vp8_640x360_2mbps_30fps.info"}, + {"", "bbb_mpeg4_1280x720_1000kbps_25fps.m4v"}, + {"", "bbb_mpeg4_1280x720_1000kbps_25fps.info"}}, + {VideoDecHidlTest::standardComp::vp8, + {"bbb_vp8_176x144_240kbps_60fps.vp8", + "bbb_vp8_640x360_2mbps_30fps.vp8"}, + {"bbb_vp8_176x144_240kbps_60fps.info", + "bbb_vp8_640x360_2mbps_30fps.info"}}, {VideoDecHidlTest::standardComp::vp9, - "bbb_vp9_640x360_1600kbps_30fps.vp9", - "bbb_vp9_640x360_1600kbps_30fps.info"}, + {"bbb_vp9_176x144_285kbps_60fps.vp9", + "bbb_vp9_640x360_1600kbps_30fps.vp9"}, + {"bbb_vp9_176x144_285kbps_60fps.info", + "bbb_vp9_640x360_1600kbps_30fps.info"}}, }; for (size_t i = 0; i < sizeof(kCompToURL) / sizeof(kCompToURL[0]); ++i) { if (kCompToURL[i].comp == comp) { - strcat(mURL, kCompToURL[i].mURL); - strcat(info, kCompToURL[i].info); + strcat(mURL, kCompToURL[i].mURL[streamIndex]); + strcat(info, kCompToURL[i].info[streamIndex]); return; } } @@ -972,9 +996,6 @@ TEST_F(VideoDecHidlTest, DecodeTest) { setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); - // disabling adaptive playback. - omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080); - android::Vector iBuffer, oBuffer; // set state to idle @@ -1015,6 +1036,139 @@ TEST_F(VideoDecHidlTest, DecodeTest) { kPortIndexInput, kPortIndexOutput); } +// Test for adaptive playback support +TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) { + description("Tests for Adaptive Playback support"); + if (disableTest) return; + if (!(compName == avc || compName == hevc || compName == vp8 || + compName == vp9 || compName == mpeg2)) + return; + android::hardware::media::omx::V1_0::Status status; + uint32_t kPortIndexInput = 0, kPortIndexOutput = 1; + status = setRole(omxNode, gEnv->getRole().c_str()); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + OMX_PORT_PARAM_TYPE params; + status = getParam(omxNode, OMX_IndexParamVideoInit, ¶ms); + if (status == ::android::hardware::media::omx::V1_0::Status::OK) { + ASSERT_EQ(params.nPorts, 2U); + kPortIndexInput = params.nStartPortNumber; + kPortIndexOutput = kPortIndexInput + 1; + } + + // set port mode + status = omxNode->setPortMode(kPortIndexInput, portMode[0]); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + + // prepare for adaptive playback + uint32_t adaptiveMaxWidth = 320; + uint32_t adaptiveMaxHeight = 240; + status = omxNode->prepareForAdaptivePlayback( + kPortIndexOutput, true, adaptiveMaxWidth, adaptiveMaxHeight); + if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) == 0) { + // SoftOMX Decoders donot support graphic buffer modes. So for them + // support for adaptive play back is mandatory in Byte Buffer mode + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + } else { + return; + } + + // TODO: Handle this better !!! + // Without the knowledge of the maximum resolution of the frame to be + // decoded it is not possible to choose the size of the input buffer. + // The value below is based on the info. files of clips in res folder. + status = setPortBufferSize(omxNode, kPortIndexInput, 482304); + ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + + // set Port Params + uint32_t nFrameWidth, nFrameHeight, xFramerate; + getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, + &xFramerate); + // get default color format + OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; + getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], + &eColorFormat); + ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); + status = + setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, xFramerate); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, + eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); + + android::Vector iBuffer, oBuffer; + + // set state to idle + changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, + kPortIndexInput, kPortIndexOutput, portMode); + // set state to executing + changeStateIdletoExecute(omxNode, observer); + + timestampDevTest = true; + uint32_t timestampOffset = 0; + for (uint32_t i = 0; i < STREAM_COUNT * 2; i++) { + std::ifstream eleStream, eleInfo; + char mURL[512], info[512]; + android::Vector Info; + strcpy(mURL, gEnv->getRes().c_str()); + strcpy(info, gEnv->getRes().c_str()); + GetURLForComponent(compName, mURL, info, i % STREAM_COUNT); + eleInfo.open(info); + ASSERT_EQ(eleInfo.is_open(), true); + int bytesCount = 0; + uint32_t flags = 0; + uint32_t timestamp = 0; + uint32_t timestampMax = 0; + while (1) { + if (!(eleInfo >> bytesCount)) break; + eleInfo >> flags; + eleInfo >> timestamp; + timestamp += timestampOffset; + Info.push_back({bytesCount, flags, timestamp}); + if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) + timestampUslist.push_back(timestamp); + if (timestampMax < timestamp) timestampMax = timestamp; + } + timestampOffset = timestampMax; + eleInfo.close(); + + // Port Reconfiguration + eleStream.open(mURL, std::ifstream::binary); + ASSERT_EQ(eleStream.is_open(), true); + decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, + kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), + portMode[1], false); + eleStream.close(); + + getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, + &nFrameHeight, &xFramerate); + if ((nFrameWidth > adaptiveMaxWidth) || + (nFrameHeight > adaptiveMaxHeight)) { + if (nFrameWidth > adaptiveMaxWidth) adaptiveMaxWidth = nFrameWidth; + if (nFrameHeight > adaptiveMaxHeight) + adaptiveMaxHeight = nFrameHeight; + EXPECT_TRUE(portSettingsChange); + } else { + // In DynamicANW Buffer mode, its ok to do a complete + // reconfiguration even if a partial reconfiguration is sufficient. + if (portMode[1] != PortMode::DYNAMIC_ANW_BUFFER) + EXPECT_FALSE(portSettingsChange); + } + portSettingsChange = false; + } + waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, + kPortIndexInput, kPortIndexOutput, portMode[1]); + testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, + portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); + if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); + // set state to idle + changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); + // set state to executing + changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, + kPortIndexInput, kPortIndexOutput); +} + // end of sequence test TEST_F(VideoDecHidlTest, EOSTest_M) { description("Test End of stream monkeying"); diff --git a/media/res/bbb_avc_176x144_300kbps_60fps.h264 b/media/res/bbb_avc_176x144_300kbps_60fps.h264 new file mode 100644 index 00000000..da1e75dc Binary files /dev/null and b/media/res/bbb_avc_176x144_300kbps_60fps.h264 differ diff --git a/media/res/bbb_avc_176x144_300kbps_60fps.info b/media/res/bbb_avc_176x144_300kbps_60fps.info new file mode 100644 index 00000000..d88b540e --- /dev/null +++ b/media/res/bbb_avc_176x144_300kbps_60fps.info @@ -0,0 +1,62 @@ +28 128 0 +10 128 0 +4780 32 33333 +960 0 100000 +480 0 66666 +246 0 50000 +264 0 83333 +1160 0 166666 +404 0 133333 +237 0 116666 +193 0 150000 +936 0 233333 +384 0 200000 +199 0 183333 +275 0 216666 +1086 0 300000 +520 0 266666 +301 0 250000 +270 0 283333 +1232 0 366666 +559 0 333333 +287 0 316666 +274 0 350000 +1084 0 433333 +485 0 400000 +307 0 383333 +284 0 416666 +1052 0 500000 +504 0 466666 +298 0 450000 +327 0 483333 +1189 0 566666 +358 0 533333 +172 0 516666 +185 0 550000 +1115 0 633333 +463 0 600000 +218 0 583333 +255 0 616666 +1155 0 700000 +622 0 666666 +356 0 650000 +341 0 683333 +1240 0 766666 +610 0 733333 +341 0 716666 +380 0 750000 +1326 0 833333 +620 0 800000 +396 0 783333 +353 0 816666 +1196 0 900000 +623 0 866666 +375 0 850000 +362 0 883333 +1192 0 966666 +654 0 933333 +359 0 916666 +352 0 950000 +828 0 1016666 +436 0 983333 +401 0 1000000 diff --git a/media/res/bbb_hevc_176x144_176kbps_60fps.hevc b/media/res/bbb_hevc_176x144_176kbps_60fps.hevc new file mode 100644 index 00000000..f82236f3 Binary files /dev/null and b/media/res/bbb_hevc_176x144_176kbps_60fps.hevc differ diff --git a/media/res/bbb_hevc_176x144_176kbps_60fps.info b/media/res/bbb_hevc_176x144_176kbps_60fps.info new file mode 100644 index 00000000..702b8536 --- /dev/null +++ b/media/res/bbb_hevc_176x144_176kbps_60fps.info @@ -0,0 +1,61 @@ +1695 128 0 +1938 32 33333 +471 0 83333 +153 0 66666 +99 0 50000 +657 0 150000 +260 0 116666 +115 0 100000 +99 0 133333 +622 0 216666 +211 0 183333 +79 0 166666 +95 0 200000 +597 0 283333 +288 0 250000 +145 0 233333 +147 0 266666 +676 0 350000 +284 0 316666 +144 0 300000 +131 0 333333 +658 0 416666 +270 0 383333 +101 0 366666 +151 0 400000 +529 0 483333 +257 0 450000 +98 0 433333 +160 0 466666 +664 0 566666 +186 0 533333 +147 0 500000 +67 0 516666 +78 0 550000 +575 0 633333 +230 0 600000 +134 0 583333 +114 0 616666 +629 0 700000 +224 0 666666 +138 0 650000 +129 0 683333 +645 0 750000 +264 0 733333 +145 0 716666 +705 0 816666 +365 0 783333 +156 0 766666 +160 0 800000 +725 0 883333 +330 0 850000 +138 0 833333 +162 0 866666 +638 0 950000 +337 0 916666 +170 0 900000 +133 0 933333 +432 0 1016666 +287 0 983333 +130 0 966666 +136 0 1000000 diff --git a/media/res/bbb_mpeg2_352x288_1mbps_60fps.info b/media/res/bbb_mpeg2_352x288_1mbps_60fps.info new file mode 100644 index 00000000..d5290d70 --- /dev/null +++ b/media/res/bbb_mpeg2_352x288_1mbps_60fps.info @@ -0,0 +1,60 @@ +16680 32 16666 +17017 0 33333 +10534 0 50000 +10289 0 66666 +3698 0 83333 +2776 0 100000 +1936 0 116666 +1493 0 133333 +1217 0 150000 +993 0 166666 +805 0 183333 +857 0 200000 +5082 32 216666 +812 0 233333 +718 0 250000 +746 0 266666 +762 0 283333 +865 0 300000 +782 0 316666 +833 0 333333 +750 0 350000 +819 0 366666 +826 0 383333 +846 0 400000 +4522 32 416666 +678 0 433333 +718 0 450000 +803 0 466666 +769 0 483333 +762 0 500000 +587 0 516666 +635 0 533333 +658 0 550000 +714 0 566666 +677 0 583333 +699 0 600000 +4616 32 616666 +800 0 633333 +831 0 650000 +928 0 666666 +869 0 683333 +931 0 700000 +930 0 716666 +974 0 733333 +978 0 750000 +932 0 766666 +918 0 783333 +978 0 800000 +4655 32 816666 +897 0 833333 +896 0 850000 +883 0 866666 +949 0 883333 +965 0 900000 +951 0 916666 +901 0 933333 +965 0 950000 +955 0 966666 +948 0 983333 +968 0 1000000 diff --git a/media/res/bbb_mpeg2_352x288_1mbps_60fps.m2v b/media/res/bbb_mpeg2_352x288_1mbps_60fps.m2v new file mode 100644 index 00000000..2f67c2b3 Binary files /dev/null and b/media/res/bbb_mpeg2_352x288_1mbps_60fps.m2v differ diff --git a/media/res/bbb_vp8_176x144_240kbps_60fps.info b/media/res/bbb_vp8_176x144_240kbps_60fps.info new file mode 100644 index 00000000..559f4258 --- /dev/null +++ b/media/res/bbb_vp8_176x144_240kbps_60fps.info @@ -0,0 +1,60 @@ +10271 32 0 +106 0 17000 +134 0 33000 +149 0 50000 +152 0 67000 +159 0 83000 +114 0 100000 +723 0 117000 +175 0 133000 +186 0 150000 +201 0 167000 +270 0 183000 +383 0 200000 +255 0 217000 +286 0 233000 +273 0 250000 +1224 0 267000 +220 0 283000 +231 0 300000 +192 0 317000 +182 0 333000 +289 0 350000 +204 0 367000 +237 0 383000 +187 0 400000 +898 0 417000 +231 0 433000 +266 0 450000 +278 0 467000 +205 0 483000 +255 0 500000 +169 0 517000 +233 0 533000 +1011 0 550000 +202 0 567000 +251 0 583000 +223 0 600000 +283 0 617000 +362 0 633000 +217 0 650000 +245 0 667000 +960 0 683000 +233 0 700000 +286 0 717000 +272 0 733000 +254 0 750000 +331 0 767000 +218 0 783000 +261 0 800000 +981 0 817000 +226 0 833000 +226 0 850000 +279 0 867000 +225 0 883000 +295 0 900000 +175 0 917000 +249 0 933000 +996 0 950000 +169 0 967000 +224 0 983000 diff --git a/media/res/bbb_vp8_176x144_240kbps_60fps.vp8 b/media/res/bbb_vp8_176x144_240kbps_60fps.vp8 new file mode 100644 index 00000000..6eba56cc Binary files /dev/null and b/media/res/bbb_vp8_176x144_240kbps_60fps.vp8 differ diff --git a/media/res/bbb_vp9_176x144_285kbps_60fps.info b/media/res/bbb_vp9_176x144_285kbps_60fps.info new file mode 100644 index 00000000..2f7d35be --- /dev/null +++ b/media/res/bbb_vp9_176x144_285kbps_60fps.info @@ -0,0 +1,60 @@ +6939 32 0 +6818 0 17000 +310 0 33000 +273 0 50000 +267 0 67000 +239 0 83000 +232 0 100000 +222 0 117000 +186 0 133000 +194 0 150000 +189 0 167000 +18 0 183000 +2014 0 200000 +297 0 217000 +287 0 233000 +237 0 250000 +263 0 267000 +238 0 283000 +257 0 300000 +229 0 317000 +187 0 333000 +191 0 350000 +18 0 367000 +2203 0 383000 +265 0 400000 +224 0 417000 +254 0 433000 +252 0 450000 +273 0 467000 +208 0 483000 +154 0 500000 +182 0 517000 +138 0 533000 +18 0 550000 +2502 0 567000 +286 0 583000 +304 0 600000 +341 0 617000 +259 0 633000 +275 0 650000 +222 0 667000 +254 0 683000 +253 0 700000 +225 0 717000 +18 0 733000 +2501 0 750000 +282 0 767000 +298 0 783000 +252 0 800000 +242 0 817000 +250 0 833000 +260 0 850000 +218 0 867000 +213 0 883000 +144 0 900000 +18 0 917000 +233 0 933000 +254 0 950000 +229 0 967000 +239 0 983000 diff --git a/media/res/bbb_vp9_176x144_285kbps_60fps.vp9 b/media/res/bbb_vp9_176x144_285kbps_60fps.vp9 new file mode 100644 index 00000000..2633c8a6 Binary files /dev/null and b/media/res/bbb_vp9_176x144_285kbps_60fps.vp9 differ