diff options
author | Ram Mohan M | 2017-09-15 04:33:02 -0500 |
---|---|---|
committer | Pawin Vongmasa | 2017-09-23 00:37:49 -0500 |
commit | 3864db6b0d8f845f9e39d5242e91a11999ebfcde (patch) | |
tree | 04f7cda76a90480bd33729c50ae2ca7a5d612b75 /media/omx/1.0 | |
parent | 9024c64a50bb6c19029f212d5900e3d0984d0670 (diff) | |
download | platform-hardware-interfaces-3864db6b0d8f845f9e39d5242e91a11999ebfcde.tar.gz platform-hardware-interfaces-3864db6b0d8f845f9e39d5242e91a11999ebfcde.tar.xz platform-hardware-interfaces-3864db6b0d8f845f9e39d5242e91a11999ebfcde.zip |
Loop all decode tests for all port modes supported
Many tests run their test with port mode configured to either
byte buffer mode or dynamic anw buffer mode but not both.
This change ensures that all test cases are tested for all
supported port mode configurations.
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: I600b30e09b478fdf787f0bf0ac6914006e553203
Diffstat (limited to 'media/omx/1.0')
5 files changed, 547 insertions, 439 deletions
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp index b8a16344..369db5b6 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp | |||
@@ -813,7 +813,7 @@ TEST_F(AudioDecHidlTest, DecodeTest) { | |||
813 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); | 813 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); |
814 | // set state to idle | 814 | // set state to idle |
815 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 815 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
816 | // set state to executing | 816 | // set state to loaded |
817 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 817 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
818 | kPortIndexInput, kPortIndexOutput); | 818 | kPortIndexInput, kPortIndexOutput); |
819 | } | 819 | } |
@@ -872,7 +872,7 @@ TEST_F(AudioDecHidlTest, EOSTest_M) { | |||
872 | 872 | ||
873 | // set state to idle | 873 | // set state to idle |
874 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 874 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
875 | // set state to executing | 875 | // set state to loaded |
876 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 876 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
877 | kPortIndexInput, kPortIndexOutput); | 877 | kPortIndexInput, kPortIndexOutput); |
878 | } | 878 | } |
@@ -979,7 +979,7 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) { | |||
979 | 979 | ||
980 | // set state to idle | 980 | // set state to idle |
981 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 981 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
982 | // set state to executing | 982 | // set state to loaded |
983 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 983 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
984 | kPortIndexInput, kPortIndexOutput); | 984 | kPortIndexInput, kPortIndexOutput); |
985 | } | 985 | } |
@@ -1065,7 +1065,7 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) { | |||
1065 | 1065 | ||
1066 | // set state to idle | 1066 | // set state to idle |
1067 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1067 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1068 | // set state to executing | 1068 | // set state to loaded |
1069 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1069 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
1070 | kPortIndexInput, kPortIndexOutput); | 1070 | kPortIndexInput, kPortIndexOutput); |
1071 | } | 1071 | } |
@@ -1169,7 +1169,7 @@ TEST_F(AudioDecHidlTest, FlushTest) { | |||
1169 | 1169 | ||
1170 | // set state to idle | 1170 | // set state to idle |
1171 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1171 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1172 | // set state to executing | 1172 | // set state to loaded |
1173 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1173 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
1174 | kPortIndexInput, kPortIndexOutput); | 1174 | kPortIndexInput, kPortIndexOutput); |
1175 | } | 1175 | } |
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp index dd5f16af..5367a4d5 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp | |||
@@ -535,7 +535,7 @@ TEST_F(AudioEncHidlTest, SimpleEncodeTest) { | |||
535 | 535 | ||
536 | // set state to idle | 536 | // set state to idle |
537 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 537 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
538 | // set state to executing | 538 | // set state to loaded |
539 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 539 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
540 | kPortIndexInput, kPortIndexOutput); | 540 | kPortIndexInput, kPortIndexOutput); |
541 | } | 541 | } |
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 070dc4c1..eeca5997 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | |||
@@ -671,8 +671,8 @@ android::DescribeColorFormatParams::DescribeColorFormatParams( | |||
671 | bUsingNativeBuffers = params.bUsingNativeBuffers; | 671 | bUsingNativeBuffers = params.bUsingNativeBuffers; |
672 | }; | 672 | }; |
673 | 673 | ||
674 | bool isColorFormatFlexibleYUV(sp<IOmxNode> omxNode, | 674 | bool isColorFormatFlexibleYUV420(sp<IOmxNode> omxNode, |
675 | OMX_COLOR_FORMATTYPE eColorFormat) { | 675 | OMX_COLOR_FORMATTYPE eColorFormat) { |
676 | android::hardware::media::omx::V1_0::Status status; | 676 | android::hardware::media::omx::V1_0::Status status; |
677 | unsigned int index = OMX_IndexMax, index2 = OMX_IndexMax; | 677 | unsigned int index = OMX_IndexMax, index2 = OMX_IndexMax; |
678 | omxNode->getExtensionIndex( | 678 | omxNode->getExtensionIndex( |
@@ -740,7 +740,11 @@ bool isColorFormatFlexibleYUV(sp<IOmxNode> omxNode, | |||
740 | return false; | 740 | return false; |
741 | } | 741 | } |
742 | 742 | ||
743 | // get default color format for output port | 743 | // get default color format for output port. |
744 | // Recommended Order of Supported Color Formats : | ||
745 | // 1. most efficient hardware format | ||
746 | // 2. most efficient flexible YUV format | ||
747 | // 3. other formats | ||
744 | void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput, | 748 | void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput, |
745 | PortMode oPortMode, | 749 | PortMode oPortMode, |
746 | OMX_COLOR_FORMATTYPE* eColorFormat) { | 750 | OMX_COLOR_FORMATTYPE* eColorFormat) { |
@@ -754,13 +758,21 @@ void getDefaultColorFormat(sp<IOmxNode> omxNode, OMX_U32 kPortIndexOutput, | |||
754 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) break; | 758 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) break; |
755 | EXPECT_EQ(portFormat.eCompressionFormat, OMX_VIDEO_CodingUnused); | 759 | EXPECT_EQ(portFormat.eCompressionFormat, OMX_VIDEO_CodingUnused); |
756 | if (oPortMode != PortMode::PRESET_BYTE_BUFFER) { | 760 | if (oPortMode != PortMode::PRESET_BYTE_BUFFER) { |
761 | // In GraphicBuffermode pick first format in the list as the desired | ||
762 | // format | ||
757 | *eColorFormat = portFormat.eColorFormat; | 763 | *eColorFormat = portFormat.eColorFormat; |
758 | break; | 764 | break; |
759 | } | 765 | } |
760 | if (isColorFormatFlexibleYUV(omxNode, portFormat.eColorFormat)) { | 766 | // FlexibleYUV color format is supported in both graphic and shared mem |
767 | // mode | ||
768 | if (isColorFormatFlexibleYUV420(omxNode, portFormat.eColorFormat)) { | ||
761 | *eColorFormat = portFormat.eColorFormat; | 769 | *eColorFormat = portFormat.eColorFormat; |
762 | break; | 770 | break; |
763 | } | 771 | } |
772 | // Video components must support either OMX_COLOR_FormatYUV420Planar | ||
773 | // or OMX_COLOR_FormatYUV420SemiPlanar format in shared memory mode. | ||
774 | // Android treats Packed formats identical to the unpacked version as | ||
775 | // as all raw video buffers must be packed (nSliceHeight = height) | ||
764 | if (OMX_COLOR_FormatYUV420SemiPlanar == portFormat.eColorFormat || | 776 | if (OMX_COLOR_FormatYUV420SemiPlanar == portFormat.eColorFormat || |
765 | OMX_COLOR_FormatYUV420Planar == portFormat.eColorFormat || | 777 | OMX_COLOR_FormatYUV420Planar == portFormat.eColorFormat || |
766 | OMX_COLOR_FormatYUV420PackedPlanar == portFormat.eColorFormat || | 778 | OMX_COLOR_FormatYUV420PackedPlanar == portFormat.eColorFormat || |
@@ -842,84 +854,102 @@ TEST_F(VideoDecHidlTest, DecodeTest) { | |||
842 | eleInfo >> flags; | 854 | eleInfo >> flags; |
843 | eleInfo >> timestamp; | 855 | eleInfo >> timestamp; |
844 | Info.push_back({bytesCount, flags, timestamp}); | 856 | Info.push_back({bytesCount, flags, timestamp}); |
845 | if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) | ||
846 | timestampUslist.push_back(timestamp); | ||
847 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | 857 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; |
848 | } | 858 | } |
849 | eleInfo.close(); | ||
850 | |||
851 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
852 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | 859 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); |
853 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | 860 | eleInfo.close(); |
854 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
855 | 861 | ||
856 | // Change the port modes arbitrarily at the start before finialising on the | ||
857 | // desired values. | ||
858 | PortMode dummyPM[] = { | 862 | PortMode dummyPM[] = { |
859 | PortMode::PRESET_BYTE_BUFFER, PortMode::PRESET_ANW_BUFFER, | 863 | PortMode::PRESET_BYTE_BUFFER, PortMode::PRESET_ANW_BUFFER, |
860 | PortMode::PRESET_SECURE_BUFFER, PortMode::DYNAMIC_ANW_BUFFER, | 864 | PortMode::PRESET_SECURE_BUFFER, PortMode::DYNAMIC_ANW_BUFFER, |
861 | PortMode::DYNAMIC_NATIVE_HANDLE, | 865 | PortMode::DYNAMIC_NATIVE_HANDLE, |
862 | }; | 866 | }; |
863 | for (size_t k = 0; k < sizeof(dummyPM) / sizeof(dummyPM[0]); k++) { | 867 | PortMode pmArray[] = {PortMode::PRESET_BYTE_BUFFER, |
864 | // ports may or may not support these modes. These are not the final | 868 | PortMode::DYNAMIC_ANW_BUFFER, |
865 | // values. This init is done to test if causes any problems. | 869 | PortMode::PRESET_ANW_BUFFER}; |
866 | status = omxNode->setPortMode(kPortIndexInput, dummyPM[k]); | 870 | |
867 | status = omxNode->setPortMode(kPortIndexOutput, dummyPM[k]); | 871 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
868 | } | 872 | // Change the port modes arbitrarily at the start before finialising |
869 | 873 | // on the desired values. | |
870 | // set port mode | 874 | for (size_t k = 0; k < sizeof(dummyPM) / sizeof(dummyPM[0]); k++) { |
871 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | 875 | // ports may or may not support these modes. These are not the final |
872 | portMode[1] = PortMode::DYNAMIC_ANW_BUFFER; | 876 | // values. This init is done to test if causes any problems. |
873 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 877 | status = omxNode->setPortMode(kPortIndexInput, dummyPM[k]); |
874 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 878 | status = omxNode->setPortMode(kPortIndexOutput, dummyPM[k]); |
875 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 879 | } |
876 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | 880 | // set port mode |
877 | portMode[1] = PortMode::PRESET_BYTE_BUFFER; | 881 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; |
882 | portMode[1] = pmArray[j]; | ||
883 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
884 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
878 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 885 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); |
886 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | ||
887 | continue; | ||
888 | } | ||
889 | |||
890 | // The input width and height information is necessary for the component | ||
891 | // to configure the size of the input buffer. But this is not available. | ||
892 | // As the frame sizes are known ahead, use it to configure i/p buffer | ||
893 | // size. | ||
894 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
879 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 895 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
880 | } | ||
881 | 896 | ||
882 | // set Port Params | 897 | // prepare list of input timestamps |
883 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 898 | for (size_t frameID = 0; frameID < Info.size(); frameID++) { |
884 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | 899 | if (timestampDevTest && |
885 | &xFramerate); | 900 | (Info[frameID].flags != OMX_BUFFERFLAG_CODECCONFIG)) |
886 | // get default color format | 901 | timestampUslist.push_back(Info[frameID].timestamp); |
887 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | 902 | } |
888 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | 903 | |
889 | &eColorFormat); | 904 | // set Port Params |
890 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | 905 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
891 | status = | 906 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
892 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 907 | &nFrameHeight, &xFramerate); |
893 | eColorFormat, xFramerate); | 908 | // get default color format |
894 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 909 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
895 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 910 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
896 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 911 | &eColorFormat); |
897 | 912 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | |
898 | android::Vector<BufferInfo> iBuffer, oBuffer; | 913 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
899 | 914 | OMX_VIDEO_CodingUnused, eColorFormat, | |
900 | // set state to idle | 915 | xFramerate); |
901 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | 916 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
902 | kPortIndexInput, kPortIndexOutput, portMode, true); | 917 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
903 | // set state to executing | 918 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
904 | changeStateIdletoExecute(omxNode, observer); | 919 | xFramerate); |
905 | 920 | ||
906 | // Port Reconfiguration | 921 | android::Vector<BufferInfo> iBuffer, oBuffer; |
907 | eleStream.open(mURL, std::ifstream::binary); | 922 | |
908 | ASSERT_EQ(eleStream.is_open(), true); | 923 | // set state to idle |
909 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 924 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, |
910 | kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), | 925 | kPortIndexInput, kPortIndexOutput, portMode, |
911 | portMode[1]); | 926 | true); |
912 | eleStream.close(); | 927 | // set state to executing |
913 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, | 928 | changeStateIdletoExecute(omxNode, observer); |
914 | kPortIndexInput, kPortIndexOutput, portMode[1]); | 929 | |
915 | testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, | 930 | // Port Reconfiguration |
916 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 931 | eleStream.open(mURL, std::ifstream::binary); |
917 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); | 932 | ASSERT_EQ(eleStream.is_open(), true); |
918 | // set state to idle | 933 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
919 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 934 | kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), |
920 | // set state to executing | 935 | portMode[1]); |
921 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 936 | eleStream.close(); |
922 | kPortIndexInput, kPortIndexOutput); | 937 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, |
938 | kPortIndexInput, kPortIndexOutput, portMode[1]); | ||
939 | testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, | ||
940 | portReconfiguration, kPortIndexInput, kPortIndexOutput, | ||
941 | nullptr); | ||
942 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); | ||
943 | eosFlag = false; | ||
944 | timestampUslist.clear(); | ||
945 | framesReceived = 0; | ||
946 | timestampUs = 0; | ||
947 | // set state to idle | ||
948 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
949 | // set state to loaded | ||
950 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
951 | kPortIndexInput, kPortIndexOutput); | ||
952 | } | ||
923 | } | 953 | } |
924 | 954 | ||
925 | // Test for adaptive playback support | 955 | // Test for adaptive playback support |
@@ -941,127 +971,153 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) { | |||
941 | kPortIndexOutput = kPortIndexInput + 1; | 971 | kPortIndexOutput = kPortIndexInput + 1; |
942 | } | 972 | } |
943 | 973 | ||
944 | // set port mode | 974 | bool apbSupport = false; |
945 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | 975 | PortMode pmArray[] = { |
946 | portMode[1] = PortMode::DYNAMIC_ANW_BUFFER; | 976 | PortMode::PRESET_BYTE_BUFFER, PortMode::DYNAMIC_ANW_BUFFER, |
947 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 977 | PortMode::PRESET_ANW_BUFFER, |
948 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 978 | }; |
949 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 979 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
950 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | 980 | // set port mode |
951 | portMode[1] = PortMode::PRESET_BYTE_BUFFER; | 981 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; |
952 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 982 | portMode[1] = pmArray[j]; |
953 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 983 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); |
954 | } | ||
955 | |||
956 | // prepare for adaptive playback | ||
957 | uint32_t adaptiveMaxWidth = 320; | ||
958 | uint32_t adaptiveMaxHeight = 240; | ||
959 | status = omxNode->prepareForAdaptivePlayback( | ||
960 | kPortIndexOutput, true, adaptiveMaxWidth, adaptiveMaxHeight); | ||
961 | if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) == 0) { | ||
962 | // SoftOMX Decoders donot support graphic buffer modes. So for them | ||
963 | // support for adaptive play back is mandatory in Byte Buffer mode | ||
964 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 984 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
965 | } else { | 985 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); |
966 | // for vendor codecs, support for adaptive play back is optional | 986 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { |
967 | // in byte buffer mode. | 987 | continue; |
968 | if (portMode[1] == PortMode::PRESET_BYTE_BUFFER) return; | 988 | } |
969 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) return; | ||
970 | } | ||
971 | |||
972 | // TODO: Handle this better !!! | ||
973 | // Without the knowledge of the maximum resolution of the frame to be | ||
974 | // decoded it is not possible to choose the size of the input buffer. | ||
975 | // The value below is based on the info. files of clips in res folder. | ||
976 | status = setPortBufferSize(omxNode, kPortIndexInput, 482304); | ||
977 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
978 | |||
979 | // set Port Params | ||
980 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | ||
981 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | ||
982 | &xFramerate); | ||
983 | // get default color format | ||
984 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | ||
985 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | ||
986 | &eColorFormat); | ||
987 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | ||
988 | status = | ||
989 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | ||
990 | eColorFormat, xFramerate); | ||
991 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
992 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | ||
993 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | ||
994 | |||
995 | android::Vector<BufferInfo> iBuffer, oBuffer; | ||
996 | |||
997 | // set state to idle | ||
998 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | ||
999 | kPortIndexInput, kPortIndexOutput, portMode, true); | ||
1000 | // set state to executing | ||
1001 | changeStateIdletoExecute(omxNode, observer); | ||
1002 | 989 | ||
1003 | timestampDevTest = true; | 990 | // prepare for adaptive playback |
1004 | uint32_t timestampOffset = 0; | 991 | uint32_t adaptiveMaxWidth = 320; |
1005 | for (uint32_t i = 0; i < STREAM_COUNT * 2; i++) { | 992 | uint32_t adaptiveMaxHeight = 240; |
1006 | std::ifstream eleStream, eleInfo; | 993 | status = omxNode->prepareForAdaptivePlayback( |
1007 | char mURL[512], info[512]; | 994 | kPortIndexOutput, true, adaptiveMaxWidth, adaptiveMaxHeight); |
1008 | android::Vector<FrameData> Info; | 995 | if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) == 0) { |
1009 | strcpy(mURL, gEnv->getRes().c_str()); | 996 | // SoftOMX Decoders donot support graphic buffer modes. So for them |
1010 | strcpy(info, gEnv->getRes().c_str()); | 997 | // support for adaptive play back is mandatory in Byte Buffer mode |
1011 | GetURLForComponent(compName, mURL, info, i % STREAM_COUNT); | 998 | ASSERT_EQ(status, |
1012 | eleInfo.open(info); | 999 | ::android::hardware::media::omx::V1_0::Status::OK); |
1013 | ASSERT_EQ(eleInfo.is_open(), true); | 1000 | } else { |
1014 | int bytesCount = 0; | 1001 | // Adaptive playback not supported |
1015 | uint32_t flags = 0; | 1002 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) |
1016 | uint32_t timestamp = 0; | 1003 | continue; |
1017 | uint32_t timestampMax = 0; | 1004 | // for vendor codecs, support for adaptive play back is optional |
1018 | while (1) { | 1005 | // in byte buffer mode. But they must be supported in atleast one |
1019 | if (!(eleInfo >> bytesCount)) break; | 1006 | // graphic buffer mode |
1020 | eleInfo >> flags; | 1007 | if (portMode[1] == PortMode::PRESET_BYTE_BUFFER || |
1021 | eleInfo >> timestamp; | 1008 | apbSupport == true) |
1022 | timestamp += timestampOffset; | 1009 | continue; |
1023 | Info.push_back({bytesCount, flags, timestamp}); | 1010 | else |
1024 | if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) | 1011 | apbSupport = true; |
1025 | timestampUslist.push_back(timestamp); | ||
1026 | if (timestampMax < timestamp) timestampMax = timestamp; | ||
1027 | } | 1012 | } |
1028 | timestampOffset = timestampMax; | ||
1029 | eleInfo.close(); | ||
1030 | 1013 | ||
1031 | // Port Reconfiguration | 1014 | // TODO: Handle this better !!! |
1032 | eleStream.open(mURL, std::ifstream::binary); | 1015 | // Without the knowledge of the maximum resolution of the frame to be |
1033 | ASSERT_EQ(eleStream.is_open(), true); | 1016 | // decoded it is not possible to choose the size of the input buffer. |
1034 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1017 | // The value below is based on the info. files of clips in res folder. |
1035 | kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), | 1018 | status = setPortBufferSize(omxNode, kPortIndexInput, 482304); |
1036 | portMode[1], false); | 1019 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1037 | eleStream.close(); | ||
1038 | 1020 | ||
1021 | // set Port Params | ||
1022 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | ||
1039 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, | 1023 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
1040 | &nFrameHeight, &xFramerate); | 1024 | &nFrameHeight, &xFramerate); |
1041 | if ((nFrameWidth > adaptiveMaxWidth) || | 1025 | // get default color format |
1042 | (nFrameHeight > adaptiveMaxHeight)) { | 1026 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
1043 | if (nFrameWidth > adaptiveMaxWidth) adaptiveMaxWidth = nFrameWidth; | 1027 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
1044 | if (nFrameHeight > adaptiveMaxHeight) | 1028 | &eColorFormat); |
1045 | adaptiveMaxHeight = nFrameHeight; | 1029 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); |
1046 | EXPECT_TRUE(portSettingsChange); | 1030 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
1047 | } else { | 1031 | OMX_VIDEO_CodingUnused, eColorFormat, |
1048 | // In DynamicANW Buffer mode, its ok to do a complete | 1032 | xFramerate); |
1049 | // reconfiguration even if a partial reconfiguration is sufficient. | 1033 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1050 | if (portMode[1] != PortMode::DYNAMIC_ANW_BUFFER) | 1034 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
1051 | EXPECT_FALSE(portSettingsChange); | 1035 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
1036 | xFramerate); | ||
1037 | |||
1038 | android::Vector<BufferInfo> iBuffer, oBuffer; | ||
1039 | |||
1040 | // set state to idle | ||
1041 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | ||
1042 | kPortIndexInput, kPortIndexOutput, portMode, | ||
1043 | true); | ||
1044 | // set state to executing | ||
1045 | changeStateIdletoExecute(omxNode, observer); | ||
1046 | |||
1047 | timestampDevTest = true; | ||
1048 | uint32_t timestampOffset = 0; | ||
1049 | for (uint32_t i = 0; i < STREAM_COUNT * 2; i++) { | ||
1050 | std::ifstream eleStream, eleInfo; | ||
1051 | char mURL[512], info[512]; | ||
1052 | android::Vector<FrameData> Info; | ||
1053 | strcpy(mURL, gEnv->getRes().c_str()); | ||
1054 | strcpy(info, gEnv->getRes().c_str()); | ||
1055 | GetURLForComponent(compName, mURL, info, i % STREAM_COUNT); | ||
1056 | eleInfo.open(info); | ||
1057 | ASSERT_EQ(eleInfo.is_open(), true); | ||
1058 | int bytesCount = 0; | ||
1059 | uint32_t flags = 0; | ||
1060 | uint32_t timestamp = 0; | ||
1061 | uint32_t timestampMax = 0; | ||
1062 | while (1) { | ||
1063 | if (!(eleInfo >> bytesCount)) break; | ||
1064 | eleInfo >> flags; | ||
1065 | eleInfo >> timestamp; | ||
1066 | timestamp += timestampOffset; | ||
1067 | Info.push_back({bytesCount, flags, timestamp}); | ||
1068 | if (timestampDevTest && (flags != OMX_BUFFERFLAG_CODECCONFIG)) | ||
1069 | timestampUslist.push_back(timestamp); | ||
1070 | if (timestampMax < timestamp) timestampMax = timestamp; | ||
1071 | } | ||
1072 | timestampOffset = timestampMax; | ||
1073 | eleInfo.close(); | ||
1074 | |||
1075 | // Port Reconfiguration | ||
1076 | eleStream.open(mURL, std::ifstream::binary); | ||
1077 | ASSERT_EQ(eleStream.is_open(), true); | ||
1078 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, | ||
1079 | kPortIndexInput, kPortIndexOutput, eleStream, &Info, | ||
1080 | 0, (int)Info.size(), portMode[1], false); | ||
1081 | eleStream.close(); | ||
1082 | |||
1083 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, | ||
1084 | &nFrameHeight, &xFramerate); | ||
1085 | if ((nFrameWidth > adaptiveMaxWidth) || | ||
1086 | (nFrameHeight > adaptiveMaxHeight)) { | ||
1087 | if (nFrameWidth > adaptiveMaxWidth) | ||
1088 | adaptiveMaxWidth = nFrameWidth; | ||
1089 | if (nFrameHeight > adaptiveMaxHeight) | ||
1090 | adaptiveMaxHeight = nFrameHeight; | ||
1091 | EXPECT_TRUE(portSettingsChange); | ||
1092 | } else { | ||
1093 | // In DynamicANW Buffer mode, it is ok to do a complete | ||
1094 | // reconfiguration even if a partial reconfiguration is | ||
1095 | // sufficient. | ||
1096 | if (portMode[1] != PortMode::DYNAMIC_ANW_BUFFER) | ||
1097 | EXPECT_FALSE(portSettingsChange); | ||
1098 | } | ||
1099 | portSettingsChange = false; | ||
1052 | } | 1100 | } |
1053 | portSettingsChange = false; | 1101 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, |
1102 | kPortIndexInput, kPortIndexOutput, portMode[1]); | ||
1103 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, | ||
1104 | portReconfiguration, kPortIndexInput, kPortIndexOutput, | ||
1105 | nullptr); | ||
1106 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); | ||
1107 | eosFlag = false; | ||
1108 | timestampUslist.clear(); | ||
1109 | framesReceived = 0; | ||
1110 | timestampUs = 0; | ||
1111 | // set state to idle | ||
1112 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1113 | // set state to loaded | ||
1114 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1115 | kPortIndexInput, kPortIndexOutput); | ||
1054 | } | 1116 | } |
1055 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, | 1117 | // For Vendor components ensure apb is supported in atleast one graphic |
1056 | kPortIndexInput, kPortIndexOutput, portMode[1]); | 1118 | // buffer mode |
1057 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, | 1119 | if (strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11) != 0) |
1058 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 1120 | EXPECT_TRUE(apbSupport); |
1059 | if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); | ||
1060 | // set state to idle | ||
1061 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1062 | // set state to executing | ||
1063 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1064 | kPortIndexInput, kPortIndexOutput); | ||
1065 | } | 1121 | } |
1066 | 1122 | ||
1067 | // end of sequence test | 1123 | // end of sequence test |
@@ -1080,50 +1136,62 @@ TEST_F(VideoDecHidlTest, EOSTest_M) { | |||
1080 | kPortIndexOutput = kPortIndexInput + 1; | 1136 | kPortIndexOutput = kPortIndexInput + 1; |
1081 | } | 1137 | } |
1082 | 1138 | ||
1083 | // set port mode | 1139 | PortMode pmArray[] = {PortMode::PRESET_BYTE_BUFFER, |
1084 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 1140 | PortMode::DYNAMIC_ANW_BUFFER, |
1085 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1141 | PortMode::PRESET_ANW_BUFFER}; |
1086 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 1142 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
1087 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1143 | // set port mode |
1144 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | ||
1145 | portMode[1] = pmArray[j]; | ||
1146 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
1147 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1148 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
1149 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | ||
1150 | continue; | ||
1151 | } | ||
1088 | 1152 | ||
1089 | // set Port Params | 1153 | // set Port Params |
1090 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1154 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1091 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | 1155 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
1092 | &xFramerate); | 1156 | &nFrameHeight, &xFramerate); |
1093 | // get default color format | 1157 | // get default color format |
1094 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | 1158 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
1095 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | 1159 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
1096 | &eColorFormat); | 1160 | &eColorFormat); |
1097 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | 1161 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); |
1098 | status = | 1162 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
1099 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1163 | OMX_VIDEO_CodingUnused, eColorFormat, |
1100 | eColorFormat, xFramerate); | 1164 | xFramerate); |
1101 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1165 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1102 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1166 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
1103 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 1167 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
1104 | 1168 | xFramerate); | |
1105 | android::Vector<BufferInfo> iBuffer, oBuffer; | 1169 | |
1106 | 1170 | android::Vector<BufferInfo> iBuffer, oBuffer; | |
1107 | // set state to idle | 1171 | |
1108 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | 1172 | // set state to idle |
1109 | kPortIndexInput, kPortIndexOutput, portMode, true); | 1173 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, |
1110 | // set state to executing | 1174 | kPortIndexInput, kPortIndexOutput, portMode, |
1111 | changeStateIdletoExecute(omxNode, observer); | 1175 | true); |
1112 | 1176 | // set state to executing | |
1113 | // request EOS at the start | 1177 | changeStateIdletoExecute(omxNode, observer); |
1114 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, | 1178 | // request EOS at the start |
1115 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 1179 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, |
1116 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1180 | portReconfiguration, kPortIndexInput, kPortIndexOutput, |
1117 | kPortIndexOutput); | 1181 | nullptr); |
1118 | EXPECT_GE(framesReceived, 0U); | 1182 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1119 | framesReceived = 0; | 1183 | kPortIndexOutput); |
1120 | timestampUs = 0; | 1184 | EXPECT_GE(framesReceived, 0U); |
1121 | 1185 | eosFlag = false; | |
1122 | // set state to idle | 1186 | timestampUslist.clear(); |
1123 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1187 | framesReceived = 0; |
1124 | // set state to executing | 1188 | timestampUs = 0; |
1125 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1189 | // set state to idle |
1126 | kPortIndexInput, kPortIndexOutput); | 1190 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1191 | // set state to loaded | ||
1192 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1193 | kPortIndexInput, kPortIndexOutput); | ||
1194 | } | ||
1127 | } | 1195 | } |
1128 | 1196 | ||
1129 | // end of sequence test | 1197 | // end of sequence test |
@@ -1161,82 +1229,101 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { | |||
1161 | Info.push_back({bytesCount, flags, timestamp}); | 1229 | Info.push_back({bytesCount, flags, timestamp}); |
1162 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | 1230 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; |
1163 | } | 1231 | } |
1232 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
1164 | eleInfo.close(); | 1233 | eleInfo.close(); |
1165 | 1234 | ||
1166 | // As the frame sizes are known ahead, use it to configure i/p buffer size | 1235 | PortMode pmArray[] = {PortMode::PRESET_BYTE_BUFFER, |
1167 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | 1236 | PortMode::DYNAMIC_ANW_BUFFER, |
1168 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | 1237 | PortMode::PRESET_ANW_BUFFER}; |
1169 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1238 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
1239 | // set port mode | ||
1240 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | ||
1241 | portMode[1] = pmArray[j]; | ||
1242 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
1243 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1244 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
1245 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | ||
1246 | continue; | ||
1247 | } | ||
1170 | 1248 | ||
1171 | // set port mode | 1249 | // As the frame sizes are known ahead, use it to configure i/p buffer |
1172 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 1250 | // size |
1173 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1251 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); |
1174 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 1252 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1175 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1176 | 1253 | ||
1177 | // set Port Params | 1254 | // set Port Params |
1178 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1255 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1179 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | 1256 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
1180 | &xFramerate); | 1257 | &nFrameHeight, &xFramerate); |
1181 | // get default color format | 1258 | // get default color format |
1182 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | 1259 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
1183 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | 1260 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
1184 | &eColorFormat); | 1261 | &eColorFormat); |
1185 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | 1262 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); |
1186 | status = | 1263 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
1187 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1264 | OMX_VIDEO_CodingUnused, eColorFormat, |
1188 | eColorFormat, xFramerate); | 1265 | xFramerate); |
1189 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1266 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1190 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1267 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
1191 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 1268 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
1192 | 1269 | xFramerate); | |
1193 | android::Vector<BufferInfo> iBuffer, oBuffer; | 1270 | |
1194 | 1271 | android::Vector<BufferInfo> iBuffer, oBuffer; | |
1195 | // set state to idle | 1272 | |
1196 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | 1273 | // set state to idle |
1197 | kPortIndexInput, kPortIndexOutput, portMode, true); | 1274 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, |
1198 | // set state to executing | 1275 | kPortIndexInput, kPortIndexOutput, portMode, |
1199 | changeStateIdletoExecute(omxNode, observer); | 1276 | true); |
1200 | 1277 | // set state to executing | |
1201 | // request EOS for thumbnail | 1278 | changeStateIdletoExecute(omxNode, observer); |
1202 | size_t i = 0; | 1279 | |
1203 | while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++; | 1280 | // request EOS for thumbnail |
1204 | eleStream.open(mURL, std::ifstream::binary); | 1281 | size_t i = 0; |
1205 | ASSERT_EQ(eleStream.is_open(), true); | 1282 | while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++; |
1206 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1283 | eleStream.open(mURL, std::ifstream::binary); |
1207 | kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]); | 1284 | ASSERT_EQ(eleStream.is_open(), true); |
1208 | eleStream.close(); | 1285 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1209 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, | 1286 | kPortIndexOutput, eleStream, &Info, 0, i + 1, |
1210 | kPortIndexInput, kPortIndexOutput, portMode[1]); | 1287 | portMode[1]); |
1211 | testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, | 1288 | eleStream.close(); |
1212 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 1289 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, |
1213 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1290 | kPortIndexInput, kPortIndexOutput, portMode[1]); |
1214 | kPortIndexOutput); | 1291 | testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, |
1215 | EXPECT_GE(framesReceived, 1U); | 1292 | portReconfiguration, kPortIndexInput, kPortIndexOutput, |
1216 | framesReceived = 0; | 1293 | nullptr); |
1217 | timestampUs = 0; | 1294 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1218 | 1295 | kPortIndexOutput); | |
1219 | eleStream.open(mURL, std::ifstream::binary); | 1296 | EXPECT_GE(framesReceived, 1U); |
1220 | ASSERT_EQ(eleStream.is_open(), true); | 1297 | eosFlag = false; |
1221 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1298 | timestampUslist.clear(); |
1222 | kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], | 1299 | framesReceived = 0; |
1223 | false); | 1300 | timestampUs = 0; |
1224 | eleStream.close(); | 1301 | |
1225 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, | 1302 | eleStream.open(mURL, std::ifstream::binary); |
1226 | kPortIndexInput, kPortIndexOutput, portMode[1]); | 1303 | ASSERT_EQ(eleStream.is_open(), true); |
1227 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, | 1304 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1228 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 1305 | kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], |
1229 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1306 | false); |
1230 | kPortIndexOutput); | 1307 | eleStream.close(); |
1231 | EXPECT_GE(framesReceived, 1U); | 1308 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, |
1232 | framesReceived = 0; | 1309 | kPortIndexInput, kPortIndexOutput, portMode[1]); |
1233 | timestampUs = 0; | 1310 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, |
1234 | 1311 | portReconfiguration, kPortIndexInput, kPortIndexOutput, | |
1235 | // set state to idle | 1312 | nullptr); |
1236 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1313 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1237 | // set state to executing | 1314 | kPortIndexOutput); |
1238 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1315 | EXPECT_GE(framesReceived, 1U); |
1239 | kPortIndexInput, kPortIndexOutput); | 1316 | eosFlag = false; |
1317 | timestampUslist.clear(); | ||
1318 | framesReceived = 0; | ||
1319 | timestampUs = 0; | ||
1320 | |||
1321 | // set state to idle | ||
1322 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1323 | // set state to loaded | ||
1324 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1325 | kPortIndexInput, kPortIndexOutput); | ||
1326 | } | ||
1240 | } | 1327 | } |
1241 | 1328 | ||
1242 | // end of sequence test | 1329 | // end of sequence test |
@@ -1274,70 +1361,79 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) { | |||
1274 | Info.push_back({bytesCount, flags, timestamp}); | 1361 | Info.push_back({bytesCount, flags, timestamp}); |
1275 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | 1362 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; |
1276 | } | 1363 | } |
1277 | eleInfo.close(); | ||
1278 | |||
1279 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
1280 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | 1364 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); |
1281 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | 1365 | eleInfo.close(); |
1282 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1283 | 1366 | ||
1284 | // set port mode | 1367 | PortMode pmArray[] = {PortMode::PRESET_BYTE_BUFFER, |
1285 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | 1368 | PortMode::DYNAMIC_ANW_BUFFER, |
1286 | portMode[1] = PortMode::PRESET_ANW_BUFFER; | 1369 | PortMode::PRESET_ANW_BUFFER}; |
1287 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 1370 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
1288 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1371 | // set port mode |
1289 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 1372 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; |
1290 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | 1373 | portMode[1] = pmArray[j]; |
1291 | portMode[1] = PortMode::PRESET_BYTE_BUFFER; | 1374 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); |
1375 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1292 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 1376 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); |
1377 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | ||
1378 | continue; | ||
1379 | } | ||
1380 | |||
1381 | // As the frame sizes are known ahead, use it to configure i/p buffer | ||
1382 | // size | ||
1383 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
1293 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1384 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1294 | } | ||
1295 | 1385 | ||
1296 | // set Port Params | 1386 | // set Port Params |
1297 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1387 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1298 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | 1388 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
1299 | &xFramerate); | 1389 | &nFrameHeight, &xFramerate); |
1300 | // get default color format | 1390 | // get default color format |
1301 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | 1391 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
1302 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | 1392 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
1303 | &eColorFormat); | 1393 | &eColorFormat); |
1304 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | 1394 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); |
1305 | status = | 1395 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
1306 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1396 | OMX_VIDEO_CodingUnused, eColorFormat, |
1307 | eColorFormat, xFramerate); | 1397 | xFramerate); |
1308 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1398 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1309 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1399 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
1310 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 1400 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
1311 | 1401 | xFramerate); | |
1312 | android::Vector<BufferInfo> iBuffer, oBuffer; | 1402 | |
1313 | 1403 | android::Vector<BufferInfo> iBuffer, oBuffer; | |
1314 | // set state to idle | 1404 | |
1315 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | 1405 | // set state to idle |
1316 | kPortIndexInput, kPortIndexOutput, portMode, true); | 1406 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, |
1317 | // set state to executing | 1407 | kPortIndexInput, kPortIndexOutput, portMode, |
1318 | changeStateIdletoExecute(omxNode, observer); | 1408 | true); |
1319 | 1409 | // set state to executing | |
1320 | // request EOS at the end | 1410 | changeStateIdletoExecute(omxNode, observer); |
1321 | eleStream.open(mURL, std::ifstream::binary); | 1411 | |
1322 | ASSERT_EQ(eleStream.is_open(), true); | 1412 | // request EOS at the end |
1323 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1413 | eleStream.open(mURL, std::ifstream::binary); |
1324 | kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), | 1414 | ASSERT_EQ(eleStream.is_open(), true); |
1325 | portMode[1], false); | 1415 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1326 | eleStream.close(); | 1416 | kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), |
1327 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, | 1417 | portMode[1], false); |
1328 | kPortIndexInput, kPortIndexOutput, portMode[1]); | 1418 | eleStream.close(); |
1329 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, | 1419 | waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, |
1330 | portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); | 1420 | kPortIndexInput, kPortIndexOutput, portMode[1]); |
1331 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1421 | testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, |
1332 | kPortIndexOutput); | 1422 | portReconfiguration, kPortIndexInput, kPortIndexOutput, |
1333 | framesReceived = 0; | 1423 | nullptr); |
1334 | timestampUs = 0; | 1424 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1335 | 1425 | kPortIndexOutput); | |
1336 | // set state to idle | 1426 | eosFlag = false; |
1337 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1427 | timestampUslist.clear(); |
1338 | // set state to executing | 1428 | framesReceived = 0; |
1339 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1429 | timestampUs = 0; |
1340 | kPortIndexInput, kPortIndexOutput); | 1430 | |
1431 | // set state to idle | ||
1432 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1433 | // set state to loaded | ||
1434 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1435 | kPortIndexInput, kPortIndexOutput); | ||
1436 | } | ||
1341 | } | 1437 | } |
1342 | 1438 | ||
1343 | // test input/output port flush | 1439 | // test input/output port flush |
@@ -1375,84 +1471,96 @@ TEST_F(VideoDecHidlTest, FlushTest) { | |||
1375 | Info.push_back({bytesCount, flags, timestamp}); | 1471 | Info.push_back({bytesCount, flags, timestamp}); |
1376 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | 1472 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; |
1377 | } | 1473 | } |
1474 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
1378 | eleInfo.close(); | 1475 | eleInfo.close(); |
1379 | 1476 | ||
1380 | // As the frame sizes are known ahead, use it to configure i/p buffer size | 1477 | PortMode pmArray[] = {PortMode::PRESET_BYTE_BUFFER, |
1381 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | 1478 | PortMode::DYNAMIC_ANW_BUFFER, |
1382 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | 1479 | PortMode::PRESET_ANW_BUFFER}; |
1383 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1480 | for (size_t j = 0; j < sizeof(pmArray) / sizeof(pmArray[0]); j++) { |
1481 | // set port mode | ||
1482 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | ||
1483 | portMode[1] = pmArray[j]; | ||
1484 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
1485 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1486 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
1487 | if (status != ::android::hardware::media::omx::V1_0::Status::OK) { | ||
1488 | continue; | ||
1489 | } | ||
1384 | 1490 | ||
1385 | // set port mode | 1491 | // As the frame sizes are known ahead, use it to configure i/p buffer |
1386 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | 1492 | // size |
1387 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1493 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); |
1388 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | 1494 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1389 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1390 | 1495 | ||
1391 | // set Port Params | 1496 | // set Port Params |
1392 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1497 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1393 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, &nFrameHeight, | 1498 | getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, |
1394 | &xFramerate); | 1499 | &nFrameHeight, &xFramerate); |
1395 | // get default color format | 1500 | // get default color format |
1396 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; | 1501 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatUnused; |
1397 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], | 1502 | getDefaultColorFormat(omxNode, kPortIndexOutput, portMode[1], |
1398 | &eColorFormat); | 1503 | &eColorFormat); |
1399 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); | 1504 | ASSERT_NE(eColorFormat, OMX_COLOR_FormatUnused); |
1400 | status = | 1505 | status = setVideoPortFormat(omxNode, kPortIndexOutput, |
1401 | setVideoPortFormat(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1506 | OMX_VIDEO_CodingUnused, eColorFormat, |
1402 | eColorFormat, xFramerate); | 1507 | xFramerate); |
1403 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | 1508 | EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); |
1404 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 1509 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
1405 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 1510 | eColorFormat, nFrameWidth, nFrameHeight, 0, |
1406 | 1511 | xFramerate); | |
1407 | android::Vector<BufferInfo> iBuffer, oBuffer; | 1512 | |
1408 | 1513 | android::Vector<BufferInfo> iBuffer, oBuffer; | |
1409 | // set state to idle | 1514 | |
1410 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, | 1515 | // set state to idle |
1411 | kPortIndexInput, kPortIndexOutput, portMode, true); | 1516 | changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, |
1412 | // set state to executing | 1517 | kPortIndexInput, kPortIndexOutput, portMode, |
1413 | changeStateIdletoExecute(omxNode, observer); | 1518 | true); |
1414 | 1519 | // set state to executing | |
1415 | // Decode 128 frames and flush. here 128 is chosen to ensure there is a key | 1520 | changeStateIdletoExecute(omxNode, observer); |
1416 | // frame after this so that the below section can be convered for all | 1521 | |
1417 | // components | 1522 | // Decode 128 frames and flush. here 128 is chosen to ensure there is a |
1418 | int nFrames = 128; | 1523 | // key frame after this so that the below section can be convered for |
1419 | eleStream.open(mURL, std::ifstream::binary); | 1524 | // all components |
1420 | ASSERT_EQ(eleStream.is_open(), true); | 1525 | int nFrames = 128; |
1421 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1526 | eleStream.open(mURL, std::ifstream::binary); |
1422 | kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1], | 1527 | ASSERT_EQ(eleStream.is_open(), true); |
1423 | false); | ||
1424 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | ||
1425 | kPortIndexOutput); | ||
1426 | framesReceived = 0; | ||
1427 | |||
1428 | // Seek to next key frame and start decoding till the end | ||
1429 | int index = nFrames; | ||
1430 | bool keyFrame = false; | ||
1431 | while (index < (int)Info.size()) { | ||
1432 | if ((Info[index].flags & OMX_BUFFERFLAG_SYNCFRAME) == | ||
1433 | OMX_BUFFERFLAG_SYNCFRAME) { | ||
1434 | timestampUs = Info[index - 1].timestamp; | ||
1435 | keyFrame = true; | ||
1436 | break; | ||
1437 | } | ||
1438 | eleStream.ignore(Info[index].bytesCount); | ||
1439 | index++; | ||
1440 | } | ||
1441 | if (keyFrame) { | ||
1442 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | 1528 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, |
1443 | kPortIndexOutput, eleStream, &Info, index, | 1529 | kPortIndexOutput, eleStream, &Info, 0, nFrames, |
1444 | Info.size() - index, portMode[1], false); | 1530 | portMode[1], false); |
1531 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | ||
1532 | kPortIndexOutput); | ||
1533 | framesReceived = 0; | ||
1534 | |||
1535 | // Seek to next key frame and start decoding till the end | ||
1536 | int index = nFrames; | ||
1537 | bool keyFrame = false; | ||
1538 | while (index < (int)Info.size()) { | ||
1539 | if ((Info[index].flags & OMX_BUFFERFLAG_SYNCFRAME) == | ||
1540 | OMX_BUFFERFLAG_SYNCFRAME) { | ||
1541 | timestampUs = Info[index - 1].timestamp; | ||
1542 | keyFrame = true; | ||
1543 | break; | ||
1544 | } | ||
1545 | eleStream.ignore(Info[index].bytesCount); | ||
1546 | index++; | ||
1547 | } | ||
1548 | if (keyFrame) { | ||
1549 | decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, | ||
1550 | kPortIndexInput, kPortIndexOutput, eleStream, &Info, | ||
1551 | index, Info.size() - index, portMode[1], false); | ||
1552 | } | ||
1553 | eleStream.close(); | ||
1554 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | ||
1555 | kPortIndexOutput); | ||
1556 | framesReceived = 0; | ||
1557 | |||
1558 | // set state to idle | ||
1559 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1560 | // set state to loaded | ||
1561 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1562 | kPortIndexInput, kPortIndexOutput); | ||
1445 | } | 1563 | } |
1446 | eleStream.close(); | ||
1447 | flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, | ||
1448 | kPortIndexOutput); | ||
1449 | framesReceived = 0; | ||
1450 | |||
1451 | // set state to idle | ||
1452 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | ||
1453 | // set state to executing | ||
1454 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | ||
1455 | kPortIndexInput, kPortIndexOutput); | ||
1456 | } | 1564 | } |
1457 | 1565 | ||
1458 | int main(int argc, char** argv) { | 1566 | int main(int argc, char** argv) { |
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp index df90ccce..24eeea71 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp | |||
@@ -1161,7 +1161,7 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) { | |||
1161 | // set state to idle | 1161 | // set state to idle |
1162 | changeStateExecutetoIdle(omxNode, observer, &buffersource->iBuffer, | 1162 | changeStateExecutetoIdle(omxNode, observer, &buffersource->iBuffer, |
1163 | &buffersource->oBuffer); | 1163 | &buffersource->oBuffer); |
1164 | // set state to executing | 1164 | // set state to loaded |
1165 | changeStateIdletoLoaded(omxNode, observer, &buffersource->iBuffer, | 1165 | changeStateIdletoLoaded(omxNode, observer, &buffersource->iBuffer, |
1166 | &buffersource->oBuffer, kPortIndexInput, | 1166 | &buffersource->oBuffer, kPortIndexInput, |
1167 | kPortIndexOutput); | 1167 | kPortIndexOutput); |
@@ -1273,7 +1273,7 @@ TEST_F(VideoEncHidlTest, EncodeTest) { | |||
1273 | 1273 | ||
1274 | // set state to idle | 1274 | // set state to idle |
1275 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1275 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1276 | // set state to executing | 1276 | // set state to loaded |
1277 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1277 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
1278 | kPortIndexInput, kPortIndexOutput); | 1278 | kPortIndexInput, kPortIndexOutput); |
1279 | } | 1279 | } |
@@ -1432,7 +1432,7 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) { | |||
1432 | // set state to idle | 1432 | // set state to idle |
1433 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1433 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1434 | EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); | 1434 | EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); |
1435 | // set state to executing | 1435 | // set state to loaded |
1436 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1436 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
1437 | kPortIndexInput, kPortIndexOutput); | 1437 | kPortIndexInput, kPortIndexOutput); |
1438 | 1438 | ||
@@ -1543,7 +1543,7 @@ TEST_F(VideoEncHidlTest, EncodeTestEOS) { | |||
1543 | // set state to idle | 1543 | // set state to idle |
1544 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); | 1544 | changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); |
1545 | EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); | 1545 | EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); |
1546 | // set state to executing | 1546 | // set state to loaded |
1547 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, | 1547 | changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, |
1548 | kPortIndexInput, kPortIndexOutput); | 1548 | kPortIndexInput, kPortIndexOutput); |
1549 | 1549 | ||
diff --git a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp index 91aecf22..f9b78339 100644 --- a/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp +++ b/media/omx/1.0/vts/functional/video/media_video_hidl_test_common.cpp | |||
@@ -89,7 +89,7 @@ void setupRAWPort(sp<IOmxNode> omxNode, OMX_U32 portIndex, OMX_U32 nFrameWidth, | |||
89 | portDef.format.video.nFrameWidth = nFrameWidth; | 89 | portDef.format.video.nFrameWidth = nFrameWidth; |
90 | portDef.format.video.nFrameHeight = nFrameHeight; | 90 | portDef.format.video.nFrameHeight = nFrameHeight; |
91 | portDef.format.video.nStride = (((nFrameWidth + 15) >> 4) << 4); | 91 | portDef.format.video.nStride = (((nFrameWidth + 15) >> 4) << 4); |
92 | portDef.format.video.nSliceHeight = (((nFrameHeight + 15) >> 4) << 4); | 92 | portDef.format.video.nSliceHeight = nFrameHeight; |
93 | portDef.format.video.nBitrate = nBitrate; | 93 | portDef.format.video.nBitrate = nBitrate; |
94 | portDef.format.video.xFramerate = xFramerate; | 94 | portDef.format.video.xFramerate = xFramerate; |
95 | portDef.format.video.bFlagErrorConcealment = OMX_TRUE; | 95 | portDef.format.video.bFlagErrorConcealment = OMX_TRUE; |