summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Mohan M2017-10-06 21:29:35 -0500
committerandroid-build-merger2017-10-06 21:29:35 -0500
commit9b0849e333e531b6894eba9d49faea5914e5d3b9 (patch)
tree921135a1d2dabca40a74fe7488a6540bdbddef2a /media/omx/1.0
parent2739a3e614af379503028a0ed9ee25f01a9f9628 (diff)
parent3021f1fafbfb1a4b464effa543aee381f42d8080 (diff)
downloadplatform-hardware-interfaces-9b0849e333e531b6894eba9d49faea5914e5d3b9.tar.gz
platform-hardware-interfaces-9b0849e333e531b6894eba9d49faea5914e5d3b9.tar.xz
platform-hardware-interfaces-9b0849e333e531b6894eba9d49faea5914e5d3b9.zip
Merge "omxvts: exit gracefully during fatal fails" into oc-mr1-dev
am: 3021f1fafb Change-Id: I8ac8c71c0bdff6aef9f79b393ea2d570de773394
Diffstat (limited to 'media/omx/1.0')
-rw-r--r--media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp262
-rw-r--r--media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp48
-rw-r--r--media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp47
-rw-r--r--media/omx/1.0/vts/functional/common/media_hidl_test_common.h2
-rw-r--r--media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp204
-rw-r--r--media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp3
-rw-r--r--media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp255
-rw-r--r--media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp144
8 files changed, 550 insertions, 415 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 11614449..9e185f27 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -165,6 +165,7 @@ class AudioDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
165 this->omxNode = _nl; 165 this->omxNode = _nl;
166 }) 166 })
167 .isOk()); 167 .isOk());
168 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
168 ASSERT_NE(omxNode, nullptr); 169 ASSERT_NE(omxNode, nullptr);
169 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role"; 170 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
170 struct StringToName { 171 struct StringToName {
@@ -423,6 +424,9 @@ void getInputChannelInfo(sp<IOmxNode> omxNode, OMX_U32 kPortIndexInput,
423 ASSERT_EQ(status, 424 ASSERT_EQ(status,
424 ::android::hardware::media::omx::V1_0::Status::OK); 425 ::android::hardware::media::omx::V1_0::Status::OK);
425 *nChannels = param.nChannels; 426 *nChannels = param.nChannels;
427 // NOTE: For amrnb sample rate is 8k and amrwb sample rate is 16k.
428 // There is no nSampleRate field in OMX_AUDIO_PARAM_AMRTYPE. Just
429 // return 8k to avoid returning uninit variable.
426 *nSampleRate = 8000; 430 *nSampleRate = 8000;
427 break; 431 break;
428 } 432 }
@@ -548,13 +552,13 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
548 // set Port Params 552 // set Port Params
549 int32_t nChannels; 553 int32_t nChannels;
550 int32_t nSampleRate; 554 int32_t nSampleRate;
551 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 555 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
552 &nSampleRate); 556 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
553 // Configure output port 557 // Configure output port
554 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way 558 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way
555 // to 559 // to configure output PCM port. The port undergoes auto
556 // configure output PCM port. The port undergoes auto configuration 560 // configuration internally basing on parsed elementary stream
557 // internally basing on parsed elementary stream information. 561 // information.
558 if (comp != AudioDecHidlTest::standardComp::vorbis && 562 if (comp != AudioDecHidlTest::standardComp::vorbis &&
559 comp != AudioDecHidlTest::standardComp::opus && 563 comp != AudioDecHidlTest::standardComp::opus &&
560 comp != AudioDecHidlTest::standardComp::raw) { 564 comp != AudioDecHidlTest::standardComp::raw) {
@@ -563,9 +567,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
563 nSampleRate); 567 nSampleRate);
564 } 568 }
565 569
566 // If you can disable a port, then you should be able to 570 // If you can disable a port, then you should be able to enable it
567 // enable 571 // as well
568 // it as well
569 status = omxNode->sendCommand( 572 status = omxNode->sendCommand(
570 toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput); 573 toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
571 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); 574 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -576,7 +579,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
576 ASSERT_EQ(status, 579 ASSERT_EQ(status,
577 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 580 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
578 581
579 allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput); 582 ASSERT_NO_FATAL_FAILURE(
583 allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput));
580 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, 584 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer,
581 oBuffer); 585 oBuffer);
582 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); 586 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -586,14 +590,14 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
586 590
587 // dispatch output buffers 591 // dispatch output buffers
588 for (size_t i = 0; i < oBuffer->size(); i++) { 592 for (size_t i = 0; i < oBuffer->size(); i++) {
589 dispatchOutputBuffer(omxNode, oBuffer, i); 593 ASSERT_NO_FATAL_FAILURE(
594 dispatchOutputBuffer(omxNode, oBuffer, i));
590 } 595 }
591 } else { 596 } else {
592 ASSERT_TRUE(false); 597 ASSERT_TRUE(false);
593 } 598 }
594 } else { 599 } else {
595 EXPECT_TRUE(false); 600 ASSERT_TRUE(false);
596 return;
597 } 601 }
598} 602}
599 603
@@ -613,11 +617,12 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
613 status = 617 status =
614 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); 618 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
615 if (status == android::hardware::media::omx::V1_0::Status::OK) { 619 if (status == android::hardware::media::omx::V1_0::Status::OK) {
616 EXPECT_EQ(msg.type, Message::Type::EVENT); 620 ASSERT_EQ(msg.type, Message::Type::EVENT);
617 packedArgs audioArgs = {eEncoding, comp}; 621 packedArgs audioArgs = {eEncoding, comp};
618 portReconfiguration(omxNode, observer, iBuffer, oBuffer, 622 ASSERT_NO_FATAL_FAILURE(
619 kPortIndexInput, kPortIndexOutput, msg, 623 portReconfiguration(omxNode, observer, iBuffer, oBuffer,
620 PortMode::PRESET_BYTE_BUFFER, &audioArgs); 624 kPortIndexInput, kPortIndexOutput, msg,
625 PortMode::PRESET_BYTE_BUFFER, &audioArgs));
621 } 626 }
622 // status == TIMED_OUT, it could be due to process time being large 627 // status == TIMED_OUT, it could be due to process time being large
623 // than DEFAULT_TIMEOUT or component needs output buffers to start 628 // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -630,7 +635,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
630 // Dispatch an output buffer assuming outQueue.empty() is true 635 // Dispatch an output buffer assuming outQueue.empty() is true
631 size_t index; 636 size_t index;
632 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 637 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
633 dispatchOutputBuffer(omxNode, oBuffer, index); 638 ASSERT_NO_FATAL_FAILURE(
639 dispatchOutputBuffer(omxNode, oBuffer, index));
634 timeOut = TIMEOUT_COUNTER_Q; 640 timeOut = TIMEOUT_COUNTER_Q;
635 } 641 }
636 } 642 }
@@ -660,9 +666,10 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
660 if (status == android::hardware::media::omx::V1_0::Status::OK && 666 if (status == android::hardware::media::omx::V1_0::Status::OK &&
661 msg.type == Message::Type::EVENT) { 667 msg.type == Message::Type::EVENT) {
662 packedArgs audioArgs = {eEncoding, comp}; 668 packedArgs audioArgs = {eEncoding, comp};
663 portReconfiguration(omxNode, observer, iBuffer, oBuffer, 669 ASSERT_NO_FATAL_FAILURE(
664 kPortIndexInput, kPortIndexOutput, msg, 670 portReconfiguration(omxNode, observer, iBuffer, oBuffer,
665 PortMode::PRESET_BYTE_BUFFER, &audioArgs); 671 kPortIndexInput, kPortIndexOutput, msg,
672 PortMode::PRESET_BYTE_BUFFER, &audioArgs));
666 } 673 }
667 674
668 if (frameID == (int)Info->size() || frameID == (offset + range)) break; 675 if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -684,15 +691,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
684 if (signalEOS && ((frameID == (int)Info->size() - 1) || 691 if (signalEOS && ((frameID == (int)Info->size() - 1) ||
685 (frameID == (offset + range - 1)))) 692 (frameID == (offset + range - 1))))
686 flags |= OMX_BUFFERFLAG_EOS; 693 flags |= OMX_BUFFERFLAG_EOS;
687 dispatchInputBuffer(omxNode, iBuffer, index, 694 ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
688 (*Info)[frameID].bytesCount, flags, 695 omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
689 (*Info)[frameID].timestamp); 696 (*Info)[frameID].timestamp));
690 frameID++; 697 frameID++;
691 iQueued = true; 698 iQueued = true;
692 } 699 }
693 // Dispatch output buffer 700 // Dispatch output buffer
694 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 701 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
695 dispatchOutputBuffer(omxNode, oBuffer, index); 702 ASSERT_NO_FATAL_FAILURE(
703 dispatchOutputBuffer(omxNode, oBuffer, index));
696 oQueued = true; 704 oQueued = true;
697 } 705 }
698 // Reset Counters when either input or output buffer is dispatched 706 // Reset Counters when either input or output buffer is dispatched
@@ -701,8 +709,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
701 else 709 else
702 timeOut--; 710 timeOut--;
703 if (timeOut == 0) { 711 if (timeOut == 0) {
704 EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; 712 ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
705 break;
706 } 713 }
707 } 714 }
708} 715}
@@ -784,8 +791,8 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
784 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000, 791 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
785 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned, 792 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
786 32); 793 32);
787 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 794 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
788 &nSampleRate); 795 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
789 // Configure output port 796 // Configure output port
790 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to 797 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
791 // configure output PCM port. The port undergoes auto configuration 798 // configure output PCM port. The port undergoes auto configuration
@@ -798,28 +805,33 @@ TEST_F(AudioDecHidlTest, DecodeTest) {
798 android::Vector<BufferInfo> iBuffer, oBuffer; 805 android::Vector<BufferInfo> iBuffer, oBuffer;
799 806
800 // set state to idle 807 // set state to idle
801 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 808 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
802 kPortIndexInput, kPortIndexOutput); 809 &oBuffer, kPortIndexInput,
810 kPortIndexOutput));
803 // set state to executing 811 // set state to executing
804 changeStateIdletoExecute(omxNode, observer); 812 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
805 // Port Reconfiguration 813 // Port Reconfiguration
806 eleStream.open(mURL, std::ifstream::binary); 814 eleStream.open(mURL, std::ifstream::binary);
807 ASSERT_EQ(eleStream.is_open(), true); 815 ASSERT_EQ(eleStream.is_open(), true);
808 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 816 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
809 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, 817 omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
810 (int)Info.size(), compName); 818 kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), compName));
811 eleStream.close(); 819 eleStream.close();
812 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 820 ASSERT_NO_FATAL_FAILURE(
813 kPortIndexInput, kPortIndexOutput, compName); 821 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
822 kPortIndexInput, kPortIndexOutput, compName));
814 packedArgs audioArgs = {eEncoding, compName}; 823 packedArgs audioArgs = {eEncoding, compName};
815 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr, 824 ASSERT_NO_FATAL_FAILURE(testEOS(
816 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); 825 omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
826 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
817 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); 827 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
818 // set state to idle 828 // set state to idle
819 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 829 ASSERT_NO_FATAL_FAILURE(
830 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
820 // set state to executing 831 // set state to executing
821 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 832 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
822 kPortIndexInput, kPortIndexOutput); 833 &oBuffer, kPortIndexInput,
834 kPortIndexOutput));
823} 835}
824 836
825// end of sequence test 837// end of sequence test
@@ -845,8 +857,8 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
845 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000, 857 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
846 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned, 858 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
847 32); 859 32);
848 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 860 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
849 &nSampleRate); 861 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
850 // Configure output port 862 // Configure output port
851 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to 863 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
852 // configure output PCM port. The port undergoes auto configuration 864 // configure output PCM port. The port undergoes auto configuration
@@ -859,26 +871,31 @@ TEST_F(AudioDecHidlTest, EOSTest_M) {
859 android::Vector<BufferInfo> iBuffer, oBuffer; 871 android::Vector<BufferInfo> iBuffer, oBuffer;
860 872
861 // set state to idle 873 // set state to idle
862 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 874 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
863 kPortIndexInput, kPortIndexOutput); 875 &oBuffer, kPortIndexInput,
876 kPortIndexOutput));
864 // set state to executing 877 // set state to executing
865 changeStateIdletoExecute(omxNode, observer); 878 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
866 879
867 // request EOS at the start 880 // request EOS at the start
868 packedArgs audioArgs = {eEncoding, compName}; 881 packedArgs audioArgs = {eEncoding, compName};
869 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, 882 ASSERT_NO_FATAL_FAILURE(testEOS(
870 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); 883 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
871 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 884 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
872 kPortIndexOutput); 885 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
886 kPortIndexInput, kPortIndexOutput));
873 EXPECT_GE(framesReceived, 0U); 887 EXPECT_GE(framesReceived, 0U);
874 framesReceived = 0; 888 framesReceived = 0;
875 timestampUs = 0; 889 timestampUs = 0;
876 890
877 // set state to idle 891 // set state to idle
878 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 892 ASSERT_NO_FATAL_FAILURE(
893 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
894
879 // set state to executing 895 // set state to executing
880 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 896 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
881 kPortIndexInput, kPortIndexOutput); 897 &oBuffer, kPortIndexInput,
898 kPortIndexOutput));
882} 899}
883 900
884// end of sequence test 901// end of sequence test
@@ -924,8 +941,8 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
924 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000, 941 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
925 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned, 942 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
926 32); 943 32);
927 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 944 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
928 &nSampleRate); 945 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
929 // Configure output port 946 // Configure output port
930 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to 947 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
931 // configure output PCM port. The port undergoes auto configuration 948 // configure output PCM port. The port undergoes auto configuration
@@ -938,10 +955,11 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
938 android::Vector<BufferInfo> iBuffer, oBuffer; 955 android::Vector<BufferInfo> iBuffer, oBuffer;
939 956
940 // set state to idle 957 // set state to idle
941 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 958 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
942 kPortIndexInput, kPortIndexOutput); 959 &oBuffer, kPortIndexInput,
960 kPortIndexOutput));
943 // set state to executing 961 // set state to executing
944 changeStateIdletoExecute(omxNode, observer); 962 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
945 963
946 // request EOS for thumbnail 964 // request EOS for thumbnail
947 // signal EOS flag with last frame 965 // signal EOS flag with last frame
@@ -949,17 +967,19 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
949 while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++; 967 while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
950 eleStream.open(mURL, std::ifstream::binary); 968 eleStream.open(mURL, std::ifstream::binary);
951 ASSERT_EQ(eleStream.is_open(), true); 969 ASSERT_EQ(eleStream.is_open(), true);
952 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 970 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
953 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1, 971 omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
954 compName); 972 kPortIndexOutput, eleStream, &Info, 0, i + 1, compName));
955 eleStream.close(); 973 eleStream.close();
956 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 974 ASSERT_NO_FATAL_FAILURE(
957 kPortIndexInput, kPortIndexOutput, compName); 975 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
976 kPortIndexInput, kPortIndexOutput, compName));
958 packedArgs audioArgs = {eEncoding, compName}; 977 packedArgs audioArgs = {eEncoding, compName};
959 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr, 978 ASSERT_NO_FATAL_FAILURE(testEOS(
960 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); 979 omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, nullptr,
961 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 980 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
962 kPortIndexOutput); 981 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
982 kPortIndexInput, kPortIndexOutput));
963 EXPECT_GE(framesReceived, 1U); 983 EXPECT_GE(framesReceived, 1U);
964 framesReceived = 0; 984 framesReceived = 0;
965 timestampUs = 0; 985 timestampUs = 0;
@@ -967,25 +987,29 @@ TEST_F(AudioDecHidlTest, ThumbnailTest) {
967 // signal EOS flag after last frame 987 // signal EOS flag after last frame
968 eleStream.open(mURL, std::ifstream::binary); 988 eleStream.open(mURL, std::ifstream::binary);
969 ASSERT_EQ(eleStream.is_open(), true); 989 ASSERT_EQ(eleStream.is_open(), true);
970 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 990 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
971 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, i + 1, 991 omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
972 compName, false); 992 kPortIndexOutput, eleStream, &Info, 0, i + 1, compName, false));
973 eleStream.close(); 993 eleStream.close();
974 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 994 ASSERT_NO_FATAL_FAILURE(
975 kPortIndexInput, kPortIndexOutput, compName); 995 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
976 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, 996 kPortIndexInput, kPortIndexOutput, compName));
977 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); 997 ASSERT_NO_FATAL_FAILURE(testEOS(
978 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 998 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
979 kPortIndexOutput); 999 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
1000 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1001 kPortIndexInput, kPortIndexOutput));
980 EXPECT_GE(framesReceived, 1U); 1002 EXPECT_GE(framesReceived, 1U);
981 framesReceived = 0; 1003 framesReceived = 0;
982 timestampUs = 0; 1004 timestampUs = 0;
983 1005
984 // set state to idle 1006 // set state to idle
985 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1007 ASSERT_NO_FATAL_FAILURE(
1008 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
986 // set state to executing 1009 // set state to executing
987 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1010 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
988 kPortIndexInput, kPortIndexOutput); 1011 &oBuffer, kPortIndexInput,
1012 kPortIndexOutput));
989} 1013}
990 1014
991// end of sequence test 1015// end of sequence test
@@ -1031,8 +1055,8 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
1031 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000, 1055 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
1032 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned, 1056 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
1033 32); 1057 32);
1034 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 1058 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
1035 &nSampleRate); 1059 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
1036 // Configure output port 1060 // Configure output port
1037 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to 1061 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
1038 // configure output PCM port. The port undergoes auto configuration 1062 // configure output PCM port. The port undergoes auto configuration
@@ -1045,33 +1069,39 @@ TEST_F(AudioDecHidlTest, SimpleEOSTest) {
1045 android::Vector<BufferInfo> iBuffer, oBuffer; 1069 android::Vector<BufferInfo> iBuffer, oBuffer;
1046 1070
1047 // set state to idle 1071 // set state to idle
1048 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1072 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
1049 kPortIndexInput, kPortIndexOutput); 1073 &oBuffer, kPortIndexInput,
1074 kPortIndexOutput));
1050 // set state to executing 1075 // set state to executing
1051 changeStateIdletoExecute(omxNode, observer); 1076 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1052 1077
1053 // request EOS at the end 1078 // request EOS at the end
1054 eleStream.open(mURL, std::ifstream::binary); 1079 eleStream.open(mURL, std::ifstream::binary);
1055 ASSERT_EQ(eleStream.is_open(), true); 1080 ASSERT_EQ(eleStream.is_open(), true);
1056 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 1081 ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
1057 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, 1082 eEncoding, kPortIndexInput,
1058 (int)Info.size(), compName, false); 1083 kPortIndexOutput, eleStream, &Info, 0,
1084 (int)Info.size(), compName, false));
1059 eleStream.close(); 1085 eleStream.close();
1060 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 1086 ASSERT_NO_FATAL_FAILURE(
1061 kPortIndexInput, kPortIndexOutput, compName); 1087 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
1088 kPortIndexInput, kPortIndexOutput, compName));
1062 packedArgs audioArgs = {eEncoding, compName}; 1089 packedArgs audioArgs = {eEncoding, compName};
1063 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr, 1090 ASSERT_NO_FATAL_FAILURE(testEOS(
1064 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs); 1091 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, nullptr,
1065 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1092 portReconfiguration, kPortIndexInput, kPortIndexOutput, &audioArgs));
1066 kPortIndexOutput); 1093 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1094 kPortIndexInput, kPortIndexOutput));
1067 framesReceived = 0; 1095 framesReceived = 0;
1068 timestampUs = 0; 1096 timestampUs = 0;
1069 1097
1070 // set state to idle 1098 // set state to idle
1071 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1099 ASSERT_NO_FATAL_FAILURE(
1100 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1072 // set state to executing 1101 // set state to executing
1073 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1102 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1074 kPortIndexInput, kPortIndexOutput); 1103 &oBuffer, kPortIndexInput,
1104 kPortIndexOutput));
1075} 1105}
1076 1106
1077// test input/output port flush 1107// test input/output port flush
@@ -1117,8 +1147,8 @@ TEST_F(AudioDecHidlTest, FlushTest) {
1117 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000, 1147 setDefaultPortParam(omxNode, kPortIndexInput, eEncoding, 1, 8000,
1118 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned, 1148 OMX_AUDIO_PCMModeLinear, OMX_NumericalDataSigned,
1119 32); 1149 32);
1120 getInputChannelInfo(omxNode, kPortIndexInput, eEncoding, &nChannels, 1150 ASSERT_NO_FATAL_FAILURE(getInputChannelInfo(
1121 &nSampleRate); 1151 omxNode, kPortIndexInput, eEncoding, &nChannels, &nSampleRate));
1122 // Configure output port 1152 // Configure output port
1123 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to 1153 // SPECIAL CASE: Soft Vorbis, Opus and Raw Decoders do not offer way to
1124 // configure output PCM port. The port undergoes auto configuration 1154 // configure output PCM port. The port undergoes auto configuration
@@ -1131,10 +1161,11 @@ TEST_F(AudioDecHidlTest, FlushTest) {
1131 android::Vector<BufferInfo> iBuffer, oBuffer; 1161 android::Vector<BufferInfo> iBuffer, oBuffer;
1132 1162
1133 // set state to idle 1163 // set state to idle
1134 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1164 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
1135 kPortIndexInput, kPortIndexOutput); 1165 &oBuffer, kPortIndexInput,
1166 kPortIndexOutput));
1136 // set state to executing 1167 // set state to executing
1137 changeStateIdletoExecute(omxNode, observer); 1168 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1138 1169
1139 // Decode 128 frames and flush. here 128 is chosen to ensure there is a key 1170 // Decode 128 frames and flush. here 128 is chosen to ensure there is a key
1140 // frame after this so that the below section can be convered for all 1171 // frame after this so that the below section can be convered for all
@@ -1142,11 +1173,11 @@ TEST_F(AudioDecHidlTest, FlushTest) {
1142 int nFrames = 128; 1173 int nFrames = 128;
1143 eleStream.open(mURL, std::ifstream::binary); 1174 eleStream.open(mURL, std::ifstream::binary);
1144 ASSERT_EQ(eleStream.is_open(), true); 1175 ASSERT_EQ(eleStream.is_open(), true);
1145 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 1176 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
1146 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 0, 1177 omxNode, observer, &iBuffer, &oBuffer, eEncoding, kPortIndexInput,
1147 nFrames, compName, false); 1178 kPortIndexOutput, eleStream, &Info, 0, nFrames, compName, false));
1148 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1179 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1149 kPortIndexOutput); 1180 kPortIndexInput, kPortIndexOutput));
1150 framesReceived = 0; 1181 framesReceived = 0;
1151 1182
1152 // Seek to next key frame and start decoding till the end 1183 // Seek to next key frame and start decoding till the end
@@ -1163,19 +1194,22 @@ TEST_F(AudioDecHidlTest, FlushTest) {
1163 index++; 1194 index++;
1164 } 1195 }
1165 if (keyFrame) { 1196 if (keyFrame) {
1166 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding, 1197 ASSERT_NO_FATAL_FAILURE(
1167 kPortIndexInput, kPortIndexOutput, eleStream, &Info, 1198 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, eEncoding,
1168 index, Info.size() - index, compName, false); 1199 kPortIndexInput, kPortIndexOutput, eleStream, &Info,
1200 index, Info.size() - index, compName, false));
1169 } 1201 }
1170 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1202 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1171 kPortIndexOutput); 1203 kPortIndexInput, kPortIndexOutput));
1172 framesReceived = 0; 1204 framesReceived = 0;
1173 1205
1174 // set state to idle 1206 // set state to idle
1175 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1207 ASSERT_NO_FATAL_FAILURE(
1208 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1176 // set state to executing 1209 // set state to executing
1177 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1210 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1178 kPortIndexInput, kPortIndexOutput); 1211 &oBuffer, kPortIndexInput,
1212 kPortIndexOutput));
1179} 1213}
1180 1214
1181int main(int argc, char** argv) { 1215int main(int argc, char** argv) {
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 66c46371..d8724449 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -165,6 +165,7 @@ class AudioEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
165 this->omxNode = _nl; 165 this->omxNode = _nl;
166 }) 166 })
167 .isOk()); 167 .isOk());
168 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
168 ASSERT_NE(omxNode, nullptr); 169 ASSERT_NE(omxNode, nullptr);
169 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role"; 170 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
170 struct StringToName { 171 struct StringToName {
@@ -352,7 +353,7 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
352 size_t i = 0; 353 size_t i = 0;
353 status = 354 status =
354 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); 355 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
355 EXPECT_EQ(status, 356 ASSERT_EQ(status,
356 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 357 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
357 // status == TIMED_OUT, it could be due to process time being large 358 // status == TIMED_OUT, it could be due to process time being large
358 // than DEFAULT_TIMEOUT or component needs output buffers to start 359 // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -365,7 +366,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
365 // Dispatch an output buffer assuming outQueue.empty() is true 366 // Dispatch an output buffer assuming outQueue.empty() is true
366 size_t index; 367 size_t index;
367 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 368 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
368 dispatchOutputBuffer(omxNode, oBuffer, index); 369 ASSERT_NO_FATAL_FAILURE(
370 dispatchOutputBuffer(omxNode, oBuffer, index));
369 timeOut = TIMEOUT_COUNTER_Q; 371 timeOut = TIMEOUT_COUNTER_Q;
370 } 372 }
371 } 373 }
@@ -408,15 +410,16 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
408 if (eleStream.gcount() != bytesCount) break; 410 if (eleStream.gcount() != bytesCount) break;
409 flags = OMX_BUFFERFLAG_ENDOFFRAME; 411 flags = OMX_BUFFERFLAG_ENDOFFRAME;
410 if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; 412 if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
411 dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, 413 ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
412 timestamp); 414 omxNode, iBuffer, index, bytesCount, flags, timestamp));
413 timestamp += timestampIncr; 415 timestamp += timestampIncr;
414 nFrames--; 416 nFrames--;
415 iQueued = true; 417 iQueued = true;
416 } 418 }
417 // Dispatch output buffer 419 // Dispatch output buffer
418 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 420 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
419 dispatchOutputBuffer(omxNode, oBuffer, index); 421 ASSERT_NO_FATAL_FAILURE(
422 dispatchOutputBuffer(omxNode, oBuffer, index));
420 oQueued = true; 423 oQueued = true;
421 } 424 }
422 // Reset Counters when either input or output buffer is dispatched 425 // Reset Counters when either input or output buffer is dispatched
@@ -425,8 +428,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
425 else 428 else
426 timeOut--; 429 timeOut--;
427 if (timeOut == 0) { 430 if (timeOut == 0) {
428 EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; 431 ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
429 break;
430 } 432 }
431 } 433 }
432} 434}
@@ -517,31 +519,39 @@ TEST_F(AudioEncHidlTest, SimpleEncodeTest) {
517 } 519 }
518 setupPCMPort(omxNode, kPortIndexInput, nChannels, OMX_NumericalDataSigned, 520 setupPCMPort(omxNode, kPortIndexInput, nChannels, OMX_NumericalDataSigned,
519 16, nSampleRate, OMX_AUDIO_PCMModeLinear); 521 16, nSampleRate, OMX_AUDIO_PCMModeLinear);
522
520 // Configure output port 523 // Configure output port
521 setDefaultPortParam(omxNode, kPortIndexOutput, eEncoding, compName, 524 ASSERT_NO_FATAL_FAILURE(setDefaultPortParam(omxNode, kPortIndexOutput,
522 nChannels, nSampleRate, nBitRate); 525 eEncoding, compName, nChannels,
526 nSampleRate, nBitRate));
523 527
524 android::Vector<BufferInfo> iBuffer, oBuffer; 528 android::Vector<BufferInfo> iBuffer, oBuffer;
525 529
526 // set state to idle 530 // set state to idle
527 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 531 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
528 kPortIndexInput, kPortIndexOutput); 532 &oBuffer, kPortIndexInput,
533 kPortIndexOutput));
529 // set state to executing 534 // set state to executing
530 changeStateIdletoExecute(omxNode, observer); 535 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
531 536
532 eleStream.open(mURL, std::ifstream::binary); 537 eleStream.open(mURL, std::ifstream::binary);
533 ASSERT_EQ(eleStream.is_open(), true); 538 ASSERT_EQ(eleStream.is_open(), true);
534 encodeNFrames(omxNode, observer, &iBuffer, &oBuffer, 128, samplesPerFrame, 539 ASSERT_NO_FATAL_FAILURE(encodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
535 nChannels, nSampleRate, eleStream); 540 128, samplesPerFrame, nChannels,
541 nSampleRate, eleStream));
536 eleStream.close(); 542 eleStream.close();
537 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer);
538 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag);
539 543
544 ASSERT_NO_FATAL_FAILURE(
545 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
546 ASSERT_NO_FATAL_FAILURE(
547 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
540 // set state to idle 548 // set state to idle
541 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 549 ASSERT_NO_FATAL_FAILURE(
550 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
542 // set state to executing 551 // set state to executing
543 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 552 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
544 kPortIndexInput, kPortIndexOutput); 553 &oBuffer, kPortIndexInput,
554 kPortIndexOutput));
545} 555}
546 556
547int main(int argc, char** argv) { 557int main(int argc, char** argv) {
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 28616e21..34a96a0c 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
@@ -233,7 +233,7 @@ void allocateGraphicBuffers(sp<IOmxNode> omxNode, OMX_U32 portIndex,
233 error = _s; 233 error = _s;
234 descriptor = _n1; 234 descriptor = _n1;
235 }); 235 });
236 EXPECT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE); 236 ASSERT_EQ(error, android::hardware::graphics::mapper::V2_0::Error::NONE);
237 237
238 static volatile int32_t nextId = 0; 238 static volatile int32_t nextId = 0;
239 uint64_t id = static_cast<uint64_t>(getpid()) << 32; 239 uint64_t id = static_cast<uint64_t>(getpid()) << 32;
@@ -279,7 +279,7 @@ void allocateBuffer(sp<IOmxNode> omxNode, BufferInfo* buffer, OMX_U32 portIndex,
279 } else if (portMode == PortMode::PRESET_BYTE_BUFFER || 279 } else if (portMode == PortMode::PRESET_BYTE_BUFFER ||
280 portMode == PortMode::DYNAMIC_ANW_BUFFER) { 280 portMode == PortMode::DYNAMIC_ANW_BUFFER) {
281 sp<IAllocator> allocator = IAllocator::getService("ashmem"); 281 sp<IAllocator> allocator = IAllocator::getService("ashmem");
282 EXPECT_NE(allocator.get(), nullptr); 282 ASSERT_NE(allocator.get(), nullptr);
283 283
284 buffer->owner = client; 284 buffer->owner = client;
285 buffer->omxBuffer.type = CodecBuffer::Type::SHARED_MEM; 285 buffer->omxBuffer.type = CodecBuffer::Type::SHARED_MEM;
@@ -319,13 +319,14 @@ void allocateBuffer(sp<IOmxNode> omxNode, BufferInfo* buffer, OMX_U32 portIndex,
319 OMX_PARAM_PORTDEFINITIONTYPE portDef; 319 OMX_PARAM_PORTDEFINITIONTYPE portDef;
320 status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex, 320 status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
321 &portDef); 321 &portDef);
322 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
322 int32_t nStride; 323 int32_t nStride;
323 buffer->owner = client; 324 buffer->owner = client;
324 buffer->omxBuffer.type = CodecBuffer::Type::ANW_BUFFER; 325 buffer->omxBuffer.type = CodecBuffer::Type::ANW_BUFFER;
325 allocateGraphicBuffers(omxNode, portIndex, buffer, 326 ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
326 portDef.format.video.nFrameWidth, 327 omxNode, portIndex, buffer, portDef.format.video.nFrameWidth,
327 portDef.format.video.nFrameHeight, &nStride, 328 portDef.format.video.nFrameHeight, &nStride,
328 portDef.format.video.eColorFormat); 329 portDef.format.video.eColorFormat));
329 omxNode->useBuffer( 330 omxNode->useBuffer(
330 portIndex, buffer->omxBuffer, 331 portIndex, buffer->omxBuffer,
331 [&status, &buffer](android::hardware::media::omx::V1_0::Status _s, 332 [&status, &buffer](android::hardware::media::omx::V1_0::Status _s,
@@ -352,14 +353,14 @@ void allocatePortBuffers(sp<IOmxNode> omxNode,
352 353
353 for (size_t i = 0; i < portDef.nBufferCountActual; i++) { 354 for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
354 BufferInfo buffer; 355 BufferInfo buffer;
355 allocateBuffer(omxNode, &buffer, portIndex, portDef.nBufferSize, 356 ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portIndex,
356 portMode); 357 portDef.nBufferSize, portMode));
357 if (allocGrap && portMode == PortMode::DYNAMIC_ANW_BUFFER) { 358 if (allocGrap && portMode == PortMode::DYNAMIC_ANW_BUFFER) {
358 int32_t nStride; 359 int32_t nStride;
359 allocateGraphicBuffers(omxNode, portIndex, &buffer, 360 ASSERT_NO_FATAL_FAILURE(allocateGraphicBuffers(
360 portDef.format.video.nFrameWidth, 361 omxNode, portIndex, &buffer, portDef.format.video.nFrameWidth,
361 portDef.format.video.nFrameHeight, &nStride, 362 portDef.format.video.nFrameHeight, &nStride,
362 portDef.format.video.eColorFormat); 363 portDef.format.video.eColorFormat));
363 } 364 }
364 buffArray->push(buffer); 365 buffArray->push(buffer);
365 } 366 }
@@ -391,14 +392,16 @@ void changeStateLoadedtoIdle(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
391 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); 392 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
392 393
393 // allocate buffers on input port 394 // allocate buffers on input port
394 allocatePortBuffers(omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap); 395 ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
396 omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap));
395 397
396 // Dont switch states until the ports are populated 398 // Dont switch states until the ports are populated
397 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); 399 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
398 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); 400 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT);
399 401
400 // allocate buffers on output port 402 // allocate buffers on output port
401 allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput, pm[1], allocGrap); 403 ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
404 omxNode, oBuffer, kPortIndexOutput, pm[1], allocGrap));
402 405
403 // As the ports are populated, check if the state transition is complete 406 // As the ports are populated, check if the state transition is complete
404 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); 407 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer);
@@ -645,7 +648,8 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
645 if (signalEOS) { 648 if (signalEOS) {
646 if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) { 649 if ((i = getEmptyBufferID(iBuffer)) < iBuffer->size()) {
647 // signal an empty buffer with flag set to EOS 650 // signal an empty buffer with flag set to EOS
648 dispatchInputBuffer(omxNode, iBuffer, i, 0, OMX_BUFFERFLAG_EOS, 0); 651 ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(omxNode, iBuffer, i, 0,
652 OMX_BUFFERFLAG_EOS, 0));
649 } else { 653 } else {
650 ASSERT_TRUE(false); 654 ASSERT_TRUE(false);
651 } 655 }
@@ -656,7 +660,8 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
656 // Dispatch all client owned output buffers to recover remaining frames 660 // Dispatch all client owned output buffers to recover remaining frames
657 while (1) { 661 while (1) {
658 if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 662 if ((i = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
659 dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]); 663 ASSERT_NO_FATAL_FAILURE(
664 dispatchOutputBuffer(omxNode, oBuffer, i, pm[1]));
660 // if dispatch is successful, perhaps there is a latency 665 // if dispatch is successful, perhaps there is a latency
661 // in the component. Dont be in a haste to leave. reset timeout 666 // in the component. Dont be in a haste to leave. reset timeout
662 // counter 667 // counter
@@ -672,16 +677,16 @@ void testEOS(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
672 if (status == android::hardware::media::omx::V1_0::Status::OK) { 677 if (status == android::hardware::media::omx::V1_0::Status::OK) {
673 if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { 678 if (msg.data.eventData.event == OMX_EventPortSettingsChanged) {
674 if (fptr) { 679 if (fptr) {
675 (*fptr)(omxNode, observer, iBuffer, oBuffer, 680 ASSERT_NO_FATAL_FAILURE((*fptr)(
676 kPortIndexInput, kPortIndexOutput, msg, pm[1], 681 omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
677 args); 682 kPortIndexOutput, msg, pm[1], args));
678 } else { 683 } else {
679 // something unexpected happened 684 // something unexpected happened
680 EXPECT_TRUE(false); 685 ASSERT_TRUE(false);
681 } 686 }
682 } else { 687 } else {
683 // something unexpected happened 688 // something unexpected happened
684 EXPECT_TRUE(false); 689 ASSERT_TRUE(false);
685 } 690 }
686 } 691 }
687 if (eosFlag == true) break; 692 if (eosFlag == true) break;
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 de043b2c..bec733dc 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
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2016, The Android Open Source Project 2 * Copyright 2017, The Android Open Source Project
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 5d0ac35e..401e54ab 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -149,6 +149,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase {
149 this->omxNode = _nl; 149 this->omxNode = _nl;
150 }) 150 })
151 .isOk()); 151 .isOk());
152 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
152 ASSERT_NE(omxNode, nullptr); 153 ASSERT_NE(omxNode, nullptr);
153 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role"; 154 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
154 struct StringToClass { 155 struct StringToClass {
@@ -233,7 +234,6 @@ void initPortMode(PortMode* pm, bool isSecure,
233 break; 234 break;
234 } 235 }
235 } 236 }
236 return;
237} 237}
238 238
239// test dispatch message API call 239// test dispatch message API call
@@ -410,6 +410,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
410 std::cerr << "[ ERROR ] port direction has to be read only " 410 std::cerr << "[ ERROR ] port direction has to be read only "
411 "but is changeable \n"; 411 "but is changeable \n";
412 } 412 }
413 EXPECT_EQ(portDef.eDir, mirror.eDir);
413 setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror); 414 setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
414 415
415 // Port Min BufferCount - Read Only 416 // Port Min BufferCount - Read Only
@@ -435,6 +436,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
435 EXPECT_EQ(portDef.nBufferCountActual, 436 EXPECT_EQ(portDef.nBufferCountActual,
436 mirror.nBufferCountActual + 1); 437 mirror.nBufferCountActual + 1);
437 } 438 }
439 setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
438 440
439 // Port BufferSize is although read only as per OMX-IL 1.2, android 441 // Port BufferSize is although read only as per OMX-IL 1.2, android
440 // doesnt abide by this. 442 // doesnt abide by this.
@@ -518,8 +520,9 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
518 520
519 for (size_t i = 0; i < portDef.nBufferCountActual; i++) { 521 for (size_t i = 0; i < portDef.nBufferCountActual; i++) {
520 BufferInfo buffer; 522 BufferInfo buffer;
521 allocateBuffer(omxNode, &buffer, portBase, nBufferSize, 523 ASSERT_NO_FATAL_FAILURE(allocateBuffer(omxNode, &buffer, portBase,
522 PortMode::PRESET_BYTE_BUFFER); 524 nBufferSize,
525 PortMode::PRESET_BYTE_BUFFER));
523 pBuffer.push(buffer); 526 pBuffer.push(buffer);
524 } 527 }
525 528
@@ -560,39 +563,47 @@ TEST_F(ComponentHidlTest, Flush) {
560 PortMode portMode[2]; 563 PortMode portMode[2];
561 initPortMode(portMode, isSecure, compClass); 564 initPortMode(portMode, isSecure, compClass);
562 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 565 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
563 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 566 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
564 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 567 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
565 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 568 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
566 569
567 // set state to idle 570 // set state to idle
568 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 571 ASSERT_NO_FATAL_FAILURE(
569 kPortIndexInput, kPortIndexOutput, portMode); 572 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
573 kPortIndexInput, kPortIndexOutput, portMode));
570 // set state to executing 574 // set state to executing
571 changeStateIdletoExecute(omxNode, observer); 575 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
572 // dispatch buffers 576 // dispatch buffers
573 for (size_t i = 0; i < oBuffer.size(); i++) { 577 for (size_t i = 0; i < oBuffer.size(); i++) {
574 dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]); 578 ASSERT_NO_FATAL_FAILURE(
579 dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
575 } 580 }
576 // flush port 581 // flush port
577 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 582 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
578 kPortIndexOutput); 583 kPortIndexInput, kPortIndexOutput));
584#if 0
579 // TODO: Sending empty input buffers is slightly tricky. 585 // TODO: Sending empty input buffers is slightly tricky.
580 // Components sometimes process input buffers even when output buffers are 586 // Components sometimes process input buffers even when output buffers are
581 // not dispatched. For instance Parsing sequence header does not require 587 // not dispatched. For instance Parsing sequence header does not require
582 // output buffers. In such instances sending 0 size input buffers might 588 // output buffers. In such instances sending 0 size input buffers might
583 // make component to send error events. so lets skip this aspect of testing. 589 // make component to send error events. so lets skip this aspect of testing.
584 // dispatch buffers 590 // dispatch buffers
585 // for (size_t i = 0; i < iBuffer.size(); i++) { 591 for (size_t i = 0; i < iBuffer.size(); i++) {
586 // dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]); 592 ASSERT_NO_FATAL_FAILURE(
587 // } 593 dispatchInputBuffer(omxNode, &iBuffer, i, 0, 0, 0, portMode[0]));
588 // // flush ports 594 }
589 // flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 595 // flush ports
590 // kPortIndexOutput); 596 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
597 kPortIndexInput, kPortIndexOutput));
598#endif
599
591 // set state to idle 600 // set state to idle
592 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 601 ASSERT_NO_FATAL_FAILURE(
602 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
593 // set state to loaded 603 // set state to loaded
594 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 604 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
595 kPortIndexInput, kPortIndexOutput); 605 &oBuffer, kPortIndexInput,
606 kPortIndexOutput));
596} 607}
597 608
598// Flush test - monkeying 609// Flush test - monkeying
@@ -623,9 +634,9 @@ TEST_F(ComponentHidlTest, Flush_M) {
623 PortMode portMode[2]; 634 PortMode portMode[2];
624 initPortMode(portMode, isSecure, compClass); 635 initPortMode(portMode, isSecure, compClass);
625 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 636 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
626 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 637 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
627 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 638 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
628 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 639 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
629 640
630 // // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation 641 // // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
631 // status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush), 642 // status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
@@ -633,8 +644,9 @@ TEST_F(ComponentHidlTest, Flush_M) {
633 // ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK); 644 // ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
634 645
635 // set state to idle 646 // set state to idle
636 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 647 ASSERT_NO_FATAL_FAILURE(
637 kPortIndexInput, kPortIndexOutput, portMode); 648 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
649 kPortIndexInput, kPortIndexOutput, portMode));
638 650
639 // // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation 651 // // Flush all ports ; receive error OMX_ErrorIncorrectStateOperation
640 // status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush), 652 // status = omxNode->sendCommand(toRawCommandType(OMX_CommandFlush),
@@ -642,10 +654,12 @@ TEST_F(ComponentHidlTest, Flush_M) {
642 // ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK); 654 // ASSERT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
643 655
644 // set state to executing 656 // set state to executing
645 changeStateIdletoExecute(omxNode, observer); 657 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
658
646 // dispatch buffers 659 // dispatch buffers
647 for (size_t i = 0; i < oBuffer.size(); i++) { 660 for (size_t i = 0; i < oBuffer.size(); i++) {
648 dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]); 661 ASSERT_NO_FATAL_FAILURE(
662 dispatchOutputBuffer(omxNode, &oBuffer, i, portMode[1]));
649 } 663 }
650 664
651 // // flush invalid port, expecting OMX_ErrorBadPortIndex 665 // // flush invalid port, expecting OMX_ErrorBadPortIndex
@@ -692,10 +706,12 @@ TEST_F(ComponentHidlTest, Flush_M) {
692 } 706 }
693 707
694 // set state to idle 708 // set state to idle
695 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 709 ASSERT_NO_FATAL_FAILURE(
710 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
696 // set state to loaded 711 // set state to loaded
697 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 712 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
698 kPortIndexInput, kPortIndexOutput); 713 &oBuffer, kPortIndexInput,
714 kPortIndexOutput));
699} 715}
700 716
701// test port mode configuration when the component is in various states 717// test port mode configuration when the component is in various states
@@ -726,13 +742,14 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
726 PortMode portMode[2]; 742 PortMode portMode[2];
727 initPortMode(portMode, isSecure, compClass); 743 initPortMode(portMode, isSecure, compClass);
728 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 744 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
729 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 745 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
730 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 746 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
731 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 747 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
732 748
733 // set state to idle 749 // set state to idle
734 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 750 ASSERT_NO_FATAL_FAILURE(
735 kPortIndexInput, kPortIndexOutput, portMode); 751 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
752 kPortIndexInput, kPortIndexOutput, portMode));
736 // Only Allow Port Mode configuration in loaded state 753 // Only Allow Port Mode configuration in loaded state
737 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 754 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
738 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK); 755 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -740,7 +757,7 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
740 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK); 757 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
741 758
742 // set state to executing 759 // set state to executing
743 changeStateIdletoExecute(omxNode, observer); 760 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
744 // Only Allow Port Mode configuration in loaded state 761 // Only Allow Port Mode configuration in loaded state
745 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 762 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
746 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK); 763 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -748,10 +765,12 @@ TEST_F(ComponentHidlTest, PortModeConfig) {
748 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK); 765 EXPECT_NE(status, ::android::hardware::media::omx::V1_0::Status::OK);
749 766
750 // set state to idle 767 // set state to idle
751 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 768 ASSERT_NO_FATAL_FAILURE(
769 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
752 // set state to loaded 770 // set state to loaded
753 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 771 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
754 kPortIndexInput, kPortIndexOutput); 772 &oBuffer, kPortIndexInput,
773 kPortIndexOutput));
755 774
756 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 775 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
757 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 776 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
@@ -788,9 +807,9 @@ TEST_F(ComponentHidlTest, StateTransitions) {
788 PortMode portMode[2]; 807 PortMode portMode[2];
789 initPortMode(portMode, isSecure, compClass); 808 initPortMode(portMode, isSecure, compClass);
790 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 809 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
791 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 810 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
792 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 811 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
793 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 812 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
794 813
795 // set state to idle 814 // set state to idle
796 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet), 815 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -812,8 +831,8 @@ TEST_F(ComponentHidlTest, StateTransitions) {
812 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 831 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
813 832
814 BufferInfo buffer; 833 BufferInfo buffer;
815 allocateBuffer(omxNode, &buffer, j, def.nBufferSize, 834 ASSERT_NO_FATAL_FAILURE(allocateBuffer(
816 portMode[j - portBase]); 835 omxNode, &buffer, j, def.nBufferSize, portMode[j - portBase]));
817 pBuffer[j - portBase].push(buffer); 836 pBuffer[j - portBase].push(buffer);
818 } 837 }
819 } 838 }
@@ -828,23 +847,28 @@ TEST_F(ComponentHidlTest, StateTransitions) {
828 ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle); 847 ASSERT_EQ(msg.data.eventData.data2, OMX_StateIdle);
829 848
830 // set state to executing 849 // set state to executing
831 changeStateIdletoExecute(omxNode, observer); 850 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
832 // dispatch buffers 851 // dispatch buffers
833 for (size_t i = 0; i < pBuffer[1].size(); i++) { 852 for (size_t i = 0; i < pBuffer[1].size(); i++) {
834 dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]); 853 ASSERT_NO_FATAL_FAILURE(
854 dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
835 } 855 }
836 // set state to idle 856 // set state to idle
837 changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]); 857 ASSERT_NO_FATAL_FAILURE(
838 // // set state to executing 858 changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
839 // changeStateIdletoExecute(omxNode, observer); 859#if 0
840 // // TODO: Sending empty input buffers is slightly tricky. 860 // set state to executing
841 // // dispatch buffers 861 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
842 // for (size_t i = 0; i < pBuffer[0].size(); i++) { 862 // TODO: Sending empty input buffers is slightly tricky.
843 // dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0, 863 // dispatch buffers
844 // portMode[0]); 864 for (size_t i = 0; i < pBuffer[0].size(); i++) {
845 // } 865 ASSERT_NO_FATAL_FAILURE(
846 // // set state to idle 866 dispatchInputBuffer(omxNode, &pBuffer[0], i, 0, 0, 0, portMode[0]));
847 // changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]); 867 }
868 // set state to idle
869 ASSERT_NO_FATAL_FAILURE(
870 changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
871#endif
848 872
849 // set state to loaded 873 // set state to loaded
850 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet), 874 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -908,8 +932,9 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
908 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK); 932 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
909 933
910 // set state to idle 934 // set state to idle
911 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 935 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(omxNode, observer, &iBuffer,
912 kPortIndexInput, kPortIndexOutput); 936 &oBuffer, kPortIndexInput,
937 kPortIndexOutput));
913 938
914 // set state to idle ; receive error OMX_ErrorSameState 939 // set state to idle ; receive error OMX_ErrorSameState
915 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet), 940 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -917,7 +942,7 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
917 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK); 942 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
918 943
919 // set state to executing 944 // set state to executing
920 changeStateIdletoExecute(omxNode, observer); 945 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
921 946
922 // set state to executing ; receive error OMX_ErrorSameState 947 // set state to executing ; receive error OMX_ErrorSameState
923 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet), 948 status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
@@ -929,12 +954,13 @@ TEST_F(ComponentHidlTest, DISABLED_StateTransitions_M) {
929 OMX_StateLoaded); 954 OMX_StateLoaded);
930 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK); 955 EXPECT_NE(status, android::hardware::media::omx::V1_0::Status::OK);
931 956
932 // set state to Idle 957 // set state to idle
933 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 958 ASSERT_NO_FATAL_FAILURE(
934 959 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
935 // set state to Loaded 960 // set state to loaded
936 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 961 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
937 kPortIndexInput, kPortIndexOutput); 962 &oBuffer, kPortIndexInput,
963 kPortIndexOutput));
938} 964}
939 965
940// port enable disable test 966// port enable disable test
@@ -1017,14 +1043,14 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
1017 PortMode portMode[2]; 1043 PortMode portMode[2];
1018 initPortMode(portMode, isSecure, compClass); 1044 initPortMode(portMode, isSecure, compClass);
1019 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 1045 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
1020 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1046 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1021 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 1047 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
1022 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1048 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1023 1049
1024 // set state to idle 1050 // set state to idle
1025 changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1], 1051 ASSERT_NO_FATAL_FAILURE(
1026 kPortIndexInput, kPortIndexOutput, portMode); 1052 changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
1027 1053 kPortIndexInput, kPortIndexOutput, portMode));
1028 for (size_t i = portBase; i < portBase + 2; i++) { 1054 for (size_t i = portBase; i < portBase + 2; i++) {
1029 status = 1055 status =
1030 omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i); 1056 omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i);
@@ -1072,8 +1098,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
1072 ASSERT_EQ(status, 1098 ASSERT_EQ(status,
1073 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 1099 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
1074 1100
1075 allocatePortBuffers(omxNode, &pBuffer[i - portBase], i, 1101 ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
1076 portMode[i - portBase]); 1102 omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
1077 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, 1103 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
1078 &pBuffer[0], &pBuffer[1]); 1104 &pBuffer[0], &pBuffer[1]);
1079 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); 1105 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -1087,8 +1113,9 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) {
1087 } 1113 }
1088 1114
1089 // set state to Loaded 1115 // set state to Loaded
1090 changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1], 1116 ASSERT_NO_FATAL_FAILURE(
1091 kPortIndexInput, kPortIndexOutput); 1117 changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
1118 kPortIndexInput, kPortIndexOutput));
1092} 1119}
1093 1120
1094// port enable disable test 1121// port enable disable test
@@ -1121,20 +1148,20 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
1121 PortMode portMode[2]; 1148 PortMode portMode[2];
1122 initPortMode(portMode, isSecure, compClass); 1149 initPortMode(portMode, isSecure, compClass);
1123 status = omxNode->setPortMode(kPortIndexInput, portMode[0]); 1150 status = omxNode->setPortMode(kPortIndexInput, portMode[0]);
1124 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1151 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1125 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); 1152 status = omxNode->setPortMode(kPortIndexOutput, portMode[1]);
1126 EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1153 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1127 1154
1128 // set state to idle 1155 // set state to idle
1129 changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1], 1156 ASSERT_NO_FATAL_FAILURE(
1130 kPortIndexInput, kPortIndexOutput, portMode); 1157 changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1],
1131 1158 kPortIndexInput, kPortIndexOutput, portMode));
1132 // set state to executing 1159 // set state to executing
1133 changeStateIdletoExecute(omxNode, observer); 1160 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1134
1135 // dispatch buffers 1161 // dispatch buffers
1136 for (size_t i = 0; i < pBuffer[1].size(); i++) { 1162 for (size_t i = 0; i < pBuffer[1].size(); i++) {
1137 dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]); 1163 ASSERT_NO_FATAL_FAILURE(
1164 dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1]));
1138 } 1165 }
1139 1166
1140 for (size_t i = portBase; i < portBase + 2; i++) { 1167 for (size_t i = portBase; i < portBase + 2; i++) {
@@ -1187,8 +1214,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
1187 ASSERT_EQ(status, 1214 ASSERT_EQ(status,
1188 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 1215 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
1189 1216
1190 allocatePortBuffers(omxNode, &pBuffer[i - portBase], i, 1217 ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
1191 portMode[i - portBase]); 1218 omxNode, &pBuffer[i - portBase], i, portMode[i - portBase]));
1192 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, 1219 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
1193 &pBuffer[0], &pBuffer[1]); 1220 &pBuffer[0], &pBuffer[1]);
1194 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); 1221 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
@@ -1201,12 +1228,13 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) {
1201 } 1228 }
1202 } 1229 }
1203 1230
1204 // set state to Idle 1231 // set state to idle
1205 changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]); 1232 ASSERT_NO_FATAL_FAILURE(
1206 1233 changeStateExecutetoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1]));
1207 // set state to Loaded 1234 // set state to loaded
1208 changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1], 1235 ASSERT_NO_FATAL_FAILURE(
1209 kPortIndexInput, kPortIndexOutput); 1236 changeStateIdletoLoaded(omxNode, observer, &pBuffer[0], &pBuffer[1],
1237 kPortIndexInput, kPortIndexOutput));
1210} 1238}
1211 1239
1212// port enable disable test - monkeying 1240// port enable disable test - monkeying
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
index 7cffea8c..5a31d691 100644
--- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -150,6 +150,7 @@ TEST_F(MasterHidlTest, ListServiceAttr) {
150 attributes = _nl; 150 attributes = _nl;
151 }) 151 })
152 .isOk()); 152 .isOk());
153 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
153 if (attributes.size() == 0) ALOGV("Warning, Attribute list empty"); 154 if (attributes.size() == 0) ALOGV("Warning, Attribute list empty");
154} 155}
155 156
@@ -186,6 +187,7 @@ TEST_F(MasterHidlTest, ListNodes) {
186 nodeList = _nl; 187 nodeList = _nl;
187 }) 188 })
188 .isOk()); 189 .isOk());
190 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
189 if (nodeList.size() == 0) 191 if (nodeList.size() == 0)
190 ALOGV("Warning, ComponentInfo list empty"); 192 ALOGV("Warning, ComponentInfo list empty");
191 else { 193 else {
@@ -204,6 +206,7 @@ TEST_F(MasterHidlTest, ListNodes) {
204 omxNode = _nl; 206 omxNode = _nl;
205 }) 207 })
206 .isOk()); 208 .isOk());
209 ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
207 if (omxNode == nullptr) { 210 if (omxNode == nullptr) {
208 isPass = false; 211 isPass = false;
209 std::cerr << "[ !OK ] " << nodeList[i].mName.c_str() 212 std::cerr << "[ !OK ] " << nodeList[i].mName.c_str()
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 a2547e89..667c2e12 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -166,6 +166,7 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase {
166 this->omxNode = _nl; 166 this->omxNode = _nl;
167 }) 167 })
168 .isOk()); 168 .isOk());
169 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
169 ASSERT_NE(omxNode, nullptr); 170 ASSERT_NE(omxNode, nullptr);
170 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role"; 171 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
171 struct StringToName { 172 struct StringToName {
@@ -498,8 +499,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
498 nFrameWidth, nFrameHeight, 0, xFramerate); 499 nFrameWidth, nFrameHeight, 0, xFramerate);
499 500
500 // If you can disable a port, then you should be able to 501 // If you can disable a port, then you should be able to
501 // enable 502 // enable it as well
502 // it as well
503 status = omxNode->sendCommand( 503 status = omxNode->sendCommand(
504 toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput); 504 toRawCommandType(OMX_CommandPortEnable), kPortIndexOutput);
505 ASSERT_EQ(status, 505 ASSERT_EQ(status,
@@ -512,8 +512,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
512 status, 512 status,
513 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 513 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
514 514
515 allocatePortBuffers(omxNode, oBuffer, kPortIndexOutput, 515 ASSERT_NO_FATAL_FAILURE(allocatePortBuffers(
516 oPortMode, true); 516 omxNode, oBuffer, kPortIndexOutput, oPortMode, true));
517 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, 517 status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT,
518 iBuffer, oBuffer); 518 iBuffer, oBuffer);
519 ASSERT_EQ(status, 519 ASSERT_EQ(status,
@@ -534,7 +534,8 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
534 534
535 // dispatch output buffers 535 // dispatch output buffers
536 for (size_t i = 0; i < oBuffer->size(); i++) { 536 for (size_t i = 0; i < oBuffer->size(); i++) {
537 dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode); 537 ASSERT_NO_FATAL_FAILURE(
538 dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode));
538 } 539 }
539 } else { 540 } else {
540 ASSERT_TRUE(false); 541 ASSERT_TRUE(false);
@@ -550,7 +551,7 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
550 } else if (msg.data.eventData.event == OMX_EventError) { 551 } else if (msg.data.eventData.event == OMX_EventError) {
551 std::cerr << "[ ERROR ] OMX_EventError/ " 552 std::cerr << "[ ERROR ] OMX_EventError/ "
552 "Decode Frame Call might be failed \n"; 553 "Decode Frame Call might be failed \n";
553 return; 554 ASSERT_TRUE(false);
554 } else { 555 } else {
555 // something unexpected happened 556 // something unexpected happened
556 ASSERT_TRUE(false); 557 ASSERT_TRUE(false);
@@ -572,10 +573,10 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
572 status = 573 status =
573 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); 574 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
574 if (status == android::hardware::media::omx::V1_0::Status::OK) { 575 if (status == android::hardware::media::omx::V1_0::Status::OK) {
575 EXPECT_EQ(msg.type, Message::Type::EVENT); 576 ASSERT_EQ(msg.type, Message::Type::EVENT);
576 portReconfiguration(omxNode, observer, iBuffer, oBuffer, 577 ASSERT_NO_FATAL_FAILURE(portReconfiguration(
577 kPortIndexInput, kPortIndexOutput, msg, 578 omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
578 oPortMode, nullptr); 579 kPortIndexOutput, msg, oPortMode, nullptr));
579 } 580 }
580 // status == TIMED_OUT, it could be due to process time being large 581 // status == TIMED_OUT, it could be due to process time being large
581 // than DEFAULT_TIMEOUT or component needs output buffers to start 582 // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -588,7 +589,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
588 // Dispatch an output buffer assuming outQueue.empty() is true 589 // Dispatch an output buffer assuming outQueue.empty() is true
589 size_t index; 590 size_t index;
590 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 591 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
591 dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); 592 ASSERT_NO_FATAL_FAILURE(
593 dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
592 timeOut = TIMEOUT_COUNTER_Q; 594 timeOut = TIMEOUT_COUNTER_Q;
593 } 595 }
594 } 596 }
@@ -617,9 +619,9 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
617 // Port Reconfiguration 619 // Port Reconfiguration
618 if (status == android::hardware::media::omx::V1_0::Status::OK && 620 if (status == android::hardware::media::omx::V1_0::Status::OK &&
619 msg.type == Message::Type::EVENT) { 621 msg.type == Message::Type::EVENT) {
620 portReconfiguration(omxNode, observer, iBuffer, oBuffer, 622 ASSERT_NO_FATAL_FAILURE(portReconfiguration(
621 kPortIndexInput, kPortIndexOutput, msg, 623 omxNode, observer, iBuffer, oBuffer, kPortIndexInput,
622 oPortMode, nullptr); 624 kPortIndexOutput, msg, oPortMode, nullptr));
623 } 625 }
624 626
625 if (frameID == (int)Info->size() || frameID == (offset + range)) break; 627 if (frameID == (int)Info->size() || frameID == (offset + range)) break;
@@ -641,15 +643,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
641 if (signalEOS && ((frameID == (int)Info->size() - 1) || 643 if (signalEOS && ((frameID == (int)Info->size() - 1) ||
642 (frameID == (offset + range - 1)))) 644 (frameID == (offset + range - 1))))
643 flags |= OMX_BUFFERFLAG_EOS; 645 flags |= OMX_BUFFERFLAG_EOS;
644 dispatchInputBuffer(omxNode, iBuffer, index, 646 ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
645 (*Info)[frameID].bytesCount, flags, 647 omxNode, iBuffer, index, (*Info)[frameID].bytesCount, flags,
646 (*Info)[frameID].timestamp); 648 (*Info)[frameID].timestamp));
647 frameID++; 649 frameID++;
648 iQueued = true; 650 iQueued = true;
649 } 651 }
650 // Dispatch output buffer 652 // Dispatch output buffer
651 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 653 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
652 dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); 654 ASSERT_NO_FATAL_FAILURE(
655 dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode));
653 oQueued = true; 656 oQueued = true;
654 } 657 }
655 // Reset Counters when either input or output buffer is dispatched 658 // Reset Counters when either input or output buffer is dispatched
@@ -658,8 +661,7 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
658 else 661 else
659 timeOut--; 662 timeOut--;
660 if (timeOut == 0) { 663 if (timeOut == 0) {
661 EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; 664 ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
662 break;
663 } 665 }
664 } 666 }
665} 667}
@@ -888,28 +890,33 @@ TEST_F(VideoDecHidlTest, DecodeTest) {
888 android::Vector<BufferInfo> iBuffer, oBuffer; 890 android::Vector<BufferInfo> iBuffer, oBuffer;
889 891
890 // set state to idle 892 // set state to idle
891 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 893 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
892 kPortIndexInput, kPortIndexOutput, portMode, true); 894 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
895 kPortIndexOutput, portMode, true));
893 // set state to executing 896 // set state to executing
894 changeStateIdletoExecute(omxNode, observer); 897 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
895 898
896 // Port Reconfiguration 899 // Port Reconfiguration
897 eleStream.open(mURL, std::ifstream::binary); 900 eleStream.open(mURL, std::ifstream::binary);
898 ASSERT_EQ(eleStream.is_open(), true); 901 ASSERT_EQ(eleStream.is_open(), true);
899 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 902 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
900 kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), 903 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
901 portMode[1]); 904 kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), portMode[1]));
902 eleStream.close(); 905 eleStream.close();
903 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, 906 ASSERT_NO_FATAL_FAILURE(
904 kPortIndexInput, kPortIndexOutput, portMode[1]); 907 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
905 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, 908 kPortIndexInput, kPortIndexOutput, portMode[1]));
906 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 909 ASSERT_NO_FATAL_FAILURE(testEOS(
910 omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
911 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
907 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); 912 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
908 // set state to idle 913 // set state to idle
909 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 914 ASSERT_NO_FATAL_FAILURE(
915 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
910 // set state to executing 916 // set state to executing
911 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 917 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
912 kPortIndexInput, kPortIndexOutput); 918 &oBuffer, kPortIndexInput,
919 kPortIndexOutput));
913} 920}
914 921
915// Test for adaptive playback support 922// Test for adaptive playback support
@@ -985,10 +992,11 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
985 android::Vector<BufferInfo> iBuffer, oBuffer; 992 android::Vector<BufferInfo> iBuffer, oBuffer;
986 993
987 // set state to idle 994 // set state to idle
988 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 995 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
989 kPortIndexInput, kPortIndexOutput, portMode, true); 996 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
997 kPortIndexOutput, portMode, true));
990 // set state to executing 998 // set state to executing
991 changeStateIdletoExecute(omxNode, observer); 999 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
992 1000
993 timestampDevTest = true; 1001 timestampDevTest = true;
994 uint32_t timestampOffset = 0; 1002 uint32_t timestampOffset = 0;
@@ -1021,9 +1029,10 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
1021 // Port Reconfiguration 1029 // Port Reconfiguration
1022 eleStream.open(mURL, std::ifstream::binary); 1030 eleStream.open(mURL, std::ifstream::binary);
1023 ASSERT_EQ(eleStream.is_open(), true); 1031 ASSERT_EQ(eleStream.is_open(), true);
1024 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1032 ASSERT_NO_FATAL_FAILURE(
1025 kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), 1033 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
1026 portMode[1], false); 1034 kPortIndexInput, kPortIndexOutput, eleStream, &Info,
1035 0, (int)Info.size(), portMode[1], false));
1027 eleStream.close(); 1036 eleStream.close();
1028 1037
1029 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth, 1038 getInputChannelInfo(omxNode, kPortIndexInput, &nFrameWidth,
@@ -1042,16 +1051,20 @@ TEST_F(VideoDecHidlTest, AdaptivePlaybackTest) {
1042 } 1051 }
1043 portSettingsChange = false; 1052 portSettingsChange = false;
1044 } 1053 }
1045 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, 1054 ASSERT_NO_FATAL_FAILURE(
1046 kPortIndexInput, kPortIndexOutput, portMode[1]); 1055 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
1047 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, 1056 kPortIndexInput, kPortIndexOutput, portMode[1]));
1048 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 1057 ASSERT_NO_FATAL_FAILURE(testEOS(
1058 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
1059 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
1049 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); 1060 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
1050 // set state to idle 1061 // set state to idle
1051 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1062 ASSERT_NO_FATAL_FAILURE(
1063 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1052 // set state to executing 1064 // set state to executing
1053 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1065 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1054 kPortIndexInput, kPortIndexOutput); 1066 &oBuffer, kPortIndexInput,
1067 kPortIndexOutput));
1055} 1068}
1056 1069
1057// end of sequence test 1070// end of sequence test
@@ -1095,25 +1108,29 @@ TEST_F(VideoDecHidlTest, EOSTest_M) {
1095 android::Vector<BufferInfo> iBuffer, oBuffer; 1108 android::Vector<BufferInfo> iBuffer, oBuffer;
1096 1109
1097 // set state to idle 1110 // set state to idle
1098 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1111 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
1099 kPortIndexInput, kPortIndexOutput, portMode, true); 1112 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1113 kPortIndexOutput, portMode, true));
1100 // set state to executing 1114 // set state to executing
1101 changeStateIdletoExecute(omxNode, observer); 1115 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1102 1116
1103 // request EOS at the start 1117 // request EOS at the start
1104 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, 1118 ASSERT_NO_FATAL_FAILURE(testEOS(
1105 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 1119 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
1106 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1120 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
1107 kPortIndexOutput); 1121 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1122 kPortIndexInput, kPortIndexOutput));
1108 EXPECT_GE(framesReceived, 0U); 1123 EXPECT_GE(framesReceived, 0U);
1109 framesReceived = 0; 1124 framesReceived = 0;
1110 timestampUs = 0; 1125 timestampUs = 0;
1111 1126
1112 // set state to idle 1127 // set state to idle
1113 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1128 ASSERT_NO_FATAL_FAILURE(
1129 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1114 // set state to executing 1130 // set state to executing
1115 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1131 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1116 kPortIndexInput, kPortIndexOutput); 1132 &oBuffer, kPortIndexInput,
1133 kPortIndexOutput));
1117} 1134}
1118 1135
1119// end of sequence test 1136// end of sequence test
@@ -1183,50 +1200,58 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) {
1183 android::Vector<BufferInfo> iBuffer, oBuffer; 1200 android::Vector<BufferInfo> iBuffer, oBuffer;
1184 1201
1185 // set state to idle 1202 // set state to idle
1186 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1203 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
1187 kPortIndexInput, kPortIndexOutput, portMode, true); 1204 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1205 kPortIndexOutput, portMode, true));
1188 // set state to executing 1206 // set state to executing
1189 changeStateIdletoExecute(omxNode, observer); 1207 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1190 1208
1191 // request EOS for thumbnail 1209 // request EOS for thumbnail
1192 size_t i = 0; 1210 size_t i = 0;
1193 while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++; 1211 while (!(Info[i].flags & OMX_BUFFERFLAG_SYNCFRAME)) i++;
1194 eleStream.open(mURL, std::ifstream::binary); 1212 eleStream.open(mURL, std::ifstream::binary);
1195 ASSERT_EQ(eleStream.is_open(), true); 1213 ASSERT_EQ(eleStream.is_open(), true);
1196 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1214 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
1197 kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]); 1215 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1216 kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1]));
1198 eleStream.close(); 1217 eleStream.close();
1199 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, 1218 ASSERT_NO_FATAL_FAILURE(
1200 kPortIndexInput, kPortIndexOutput, portMode[1]); 1219 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
1201 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode, 1220 kPortIndexInput, kPortIndexOutput, portMode[1]));
1202 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 1221 ASSERT_NO_FATAL_FAILURE(testEOS(
1203 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1222 omxNode, observer, &iBuffer, &oBuffer, false, eosFlag, portMode,
1204 kPortIndexOutput); 1223 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
1224 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1225 kPortIndexInput, kPortIndexOutput));
1205 EXPECT_GE(framesReceived, 1U); 1226 EXPECT_GE(framesReceived, 1U);
1206 framesReceived = 0; 1227 framesReceived = 0;
1207 timestampUs = 0; 1228 timestampUs = 0;
1208 1229
1209 eleStream.open(mURL, std::ifstream::binary); 1230 eleStream.open(mURL, std::ifstream::binary);
1210 ASSERT_EQ(eleStream.is_open(), true); 1231 ASSERT_EQ(eleStream.is_open(), true);
1211 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1232 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
1212 kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], 1233 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1213 false); 1234 kPortIndexOutput, eleStream, &Info, 0, i + 1, portMode[1], false));
1214 eleStream.close(); 1235 eleStream.close();
1215 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, 1236 ASSERT_NO_FATAL_FAILURE(
1216 kPortIndexInput, kPortIndexOutput, portMode[1]); 1237 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
1217 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, 1238 kPortIndexInput, kPortIndexOutput, portMode[1]));
1218 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 1239 ASSERT_NO_FATAL_FAILURE(testEOS(
1219 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1240 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
1220 kPortIndexOutput); 1241 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
1242 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1243 kPortIndexInput, kPortIndexOutput));
1221 EXPECT_GE(framesReceived, 1U); 1244 EXPECT_GE(framesReceived, 1U);
1222 framesReceived = 0; 1245 framesReceived = 0;
1223 timestampUs = 0; 1246 timestampUs = 0;
1224 1247
1225 // set state to idle 1248 // set state to idle
1226 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1249 ASSERT_NO_FATAL_FAILURE(
1250 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1227 // set state to executing 1251 // set state to executing
1228 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1252 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1229 kPortIndexInput, kPortIndexOutput); 1253 &oBuffer, kPortIndexInput,
1254 kPortIndexOutput));
1230} 1255}
1231 1256
1232// end of sequence test 1257// end of sequence test
@@ -1302,32 +1327,38 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) {
1302 android::Vector<BufferInfo> iBuffer, oBuffer; 1327 android::Vector<BufferInfo> iBuffer, oBuffer;
1303 1328
1304 // set state to idle 1329 // set state to idle
1305 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1330 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
1306 kPortIndexInput, kPortIndexOutput, portMode, true); 1331 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1332 kPortIndexOutput, portMode, true));
1307 // set state to executing 1333 // set state to executing
1308 changeStateIdletoExecute(omxNode, observer); 1334 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1309 1335
1310 // request EOS at the end 1336 // request EOS at the end
1311 eleStream.open(mURL, std::ifstream::binary); 1337 eleStream.open(mURL, std::ifstream::binary);
1312 ASSERT_EQ(eleStream.is_open(), true); 1338 ASSERT_EQ(eleStream.is_open(), true);
1313 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1339 ASSERT_NO_FATAL_FAILURE(decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
1314 kPortIndexOutput, eleStream, &Info, 0, (int)Info.size(), 1340 kPortIndexInput, kPortIndexOutput,
1315 portMode[1], false); 1341 eleStream, &Info, 0, (int)Info.size(),
1342 portMode[1], false));
1316 eleStream.close(); 1343 eleStream.close();
1317 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, 1344 ASSERT_NO_FATAL_FAILURE(
1318 kPortIndexInput, kPortIndexOutput, portMode[1]); 1345 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer,
1319 testEOS(omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode, 1346 kPortIndexInput, kPortIndexOutput, portMode[1]));
1320 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr); 1347 ASSERT_NO_FATAL_FAILURE(testEOS(
1321 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1348 omxNode, observer, &iBuffer, &oBuffer, true, eosFlag, portMode,
1322 kPortIndexOutput); 1349 portReconfiguration, kPortIndexInput, kPortIndexOutput, nullptr));
1350 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1351 kPortIndexInput, kPortIndexOutput));
1323 framesReceived = 0; 1352 framesReceived = 0;
1324 timestampUs = 0; 1353 timestampUs = 0;
1325 1354
1326 // set state to idle 1355 // set state to idle
1327 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1356 ASSERT_NO_FATAL_FAILURE(
1357 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1328 // set state to executing 1358 // set state to executing
1329 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1359 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1330 kPortIndexInput, kPortIndexOutput); 1360 &oBuffer, kPortIndexInput,
1361 kPortIndexOutput));
1331} 1362}
1332 1363
1333// test input/output port flush 1364// test input/output port flush
@@ -1397,10 +1428,11 @@ TEST_F(VideoDecHidlTest, FlushTest) {
1397 android::Vector<BufferInfo> iBuffer, oBuffer; 1428 android::Vector<BufferInfo> iBuffer, oBuffer;
1398 1429
1399 // set state to idle 1430 // set state to idle
1400 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1431 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
1401 kPortIndexInput, kPortIndexOutput, portMode, true); 1432 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1433 kPortIndexOutput, portMode, true));
1402 // set state to executing 1434 // set state to executing
1403 changeStateIdletoExecute(omxNode, observer); 1435 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1404 1436
1405 // Decode 128 frames and flush. here 128 is chosen to ensure there is a key 1437 // Decode 128 frames and flush. here 128 is chosen to ensure there is a key
1406 // frame after this so that the below section can be convered for all 1438 // frame after this so that the below section can be convered for all
@@ -1408,11 +1440,11 @@ TEST_F(VideoDecHidlTest, FlushTest) {
1408 int nFrames = 128; 1440 int nFrames = 128;
1409 eleStream.open(mURL, std::ifstream::binary); 1441 eleStream.open(mURL, std::ifstream::binary);
1410 ASSERT_EQ(eleStream.is_open(), true); 1442 ASSERT_EQ(eleStream.is_open(), true);
1411 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1443 ASSERT_NO_FATAL_FAILURE(decodeNFrames(
1412 kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1], 1444 omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput,
1413 false); 1445 kPortIndexOutput, eleStream, &Info, 0, nFrames, portMode[1], false));
1414 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1446 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1415 kPortIndexOutput); 1447 kPortIndexInput, kPortIndexOutput));
1416 framesReceived = 0; 1448 framesReceived = 0;
1417 1449
1418 // Seek to next key frame and start decoding till the end 1450 // Seek to next key frame and start decoding till the end
@@ -1429,20 +1461,23 @@ TEST_F(VideoDecHidlTest, FlushTest) {
1429 index++; 1461 index++;
1430 } 1462 }
1431 if (keyFrame) { 1463 if (keyFrame) {
1432 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1464 ASSERT_NO_FATAL_FAILURE(
1433 kPortIndexOutput, eleStream, &Info, index, 1465 decodeNFrames(omxNode, observer, &iBuffer, &oBuffer,
1434 Info.size() - index, portMode[1], false); 1466 kPortIndexInput, kPortIndexOutput, eleStream, &Info,
1467 index, Info.size() - index, portMode[1], false));
1435 } 1468 }
1436 eleStream.close(); 1469 eleStream.close();
1437 flushPorts(omxNode, observer, &iBuffer, &oBuffer, kPortIndexInput, 1470 ASSERT_NO_FATAL_FAILURE(flushPorts(omxNode, observer, &iBuffer, &oBuffer,
1438 kPortIndexOutput); 1471 kPortIndexInput, kPortIndexOutput));
1439 framesReceived = 0; 1472 framesReceived = 0;
1440 1473
1441 // set state to idle 1474 // set state to idle
1442 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1475 ASSERT_NO_FATAL_FAILURE(
1476 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1443 // set state to executing 1477 // set state to executing
1444 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1478 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1445 kPortIndexInput, kPortIndexOutput); 1479 &oBuffer, kPortIndexInput,
1480 kPortIndexOutput));
1446} 1481}
1447 1482
1448int main(int argc, char** argv) { 1483int 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..743ff787 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -179,6 +179,7 @@ class VideoEncHidlTest : public ::testing::VtsHalHidlTargetTestBase {
179 this->omxNode = _nl; 179 this->omxNode = _nl;
180 }) 180 })
181 .isOk()); 181 .isOk());
182 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
182 ASSERT_NE(omxNode, nullptr); 183 ASSERT_NE(omxNode, nullptr);
183 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role"; 184 ASSERT_NE(gEnv->getRole().empty(), true) << "Invalid Component Role";
184 struct StringToName { 185 struct StringToName {
@@ -617,7 +618,7 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
617 size_t i = 0; 618 size_t i = 0;
618 status = 619 status =
619 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); 620 observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer);
620 EXPECT_EQ(status, 621 ASSERT_EQ(status,
621 android::hardware::media::omx::V1_0::Status::TIMED_OUT); 622 android::hardware::media::omx::V1_0::Status::TIMED_OUT);
622 // status == TIMED_OUT, it could be due to process time being large 623 // status == TIMED_OUT, it could be due to process time being large
623 // than DEFAULT_TIMEOUT or component needs output buffers to start 624 // than DEFAULT_TIMEOUT or component needs output buffers to start
@@ -634,7 +635,8 @@ void waitOnInputConsumption(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
634 // Dispatch an output buffer assuming outQueue.empty() is true 635 // Dispatch an output buffer assuming outQueue.empty() is true
635 size_t index; 636 size_t index;
636 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 637 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
637 dispatchOutputBuffer(omxNode, oBuffer, index); 638 ASSERT_NO_FATAL_FAILURE(
639 dispatchOutputBuffer(omxNode, oBuffer, index));
638 timeOut = TIMEOUT_COUNTER_Q; 640 timeOut = TIMEOUT_COUNTER_Q;
639 } 641 }
640 } 642 }
@@ -1008,8 +1010,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
1008 ASSERT_EQ(msg.data.eventData.data2, 1010 ASSERT_EQ(msg.data.eventData.data2,
1009 OMX_IndexConfigAndroidIntraRefresh); 1011 OMX_IndexConfigAndroidIntraRefresh);
1010 } else if (msg.data.eventData.event == OMX_EventError) { 1012 } else if (msg.data.eventData.event == OMX_EventError) {
1011 EXPECT_TRUE(false) << "Received OMX_EventError, not sure why"; 1013 ASSERT_TRUE(false) << "Received OMX_EventError, not sure why";
1012 break;
1013 } else if (msg.data.eventData.event == OMX_EventDataSpaceChanged) { 1014 } else if (msg.data.eventData.event == OMX_EventDataSpaceChanged) {
1014 // TODO: how am i supposed to respond now? 1015 // TODO: how am i supposed to respond now?
1015 std::cout << "[ INFO ] OMX_EventDataSpaceChanged \n"; 1016 std::cout << "[ INFO ] OMX_EventDataSpaceChanged \n";
@@ -1025,8 +1026,13 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
1025 if (inputDataIsMeta) { 1026 if (inputDataIsMeta) {
1026 if (listener->freeBuffers > listener->minUnDequeuedCount) { 1027 if (listener->freeBuffers > listener->minUnDequeuedCount) {
1027 if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer, 1028 if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer,
1028 portIndexInput, eleStream, timestamp)) 1029 portIndexInput, eleStream,
1029 break; 1030 timestamp)) {
1031 if (::testing::Test::HasFailure())
1032 ASSERT_TRUE(false);
1033 else
1034 break;
1035 }
1030 timestamp += timestampIncr; 1036 timestamp += timestampIncr;
1031 nFrames--; 1037 nFrames--;
1032 ipCount++; 1038 ipCount++;
@@ -1044,8 +1050,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
1044 break; 1050 break;
1045 flags = OMX_BUFFERFLAG_ENDOFFRAME; 1051 flags = OMX_BUFFERFLAG_ENDOFFRAME;
1046 if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; 1052 if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS;
1047 dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, 1053 ASSERT_NO_FATAL_FAILURE(dispatchInputBuffer(
1048 timestamp); 1054 omxNode, iBuffer, index, bytesCount, flags, timestamp));
1049 if (timestampUslist) timestampUslist->push_back(timestamp); 1055 if (timestampUslist) timestampUslist->push_back(timestamp);
1050 timestamp += timestampIncr; 1056 timestamp += timestampIncr;
1051 nFrames--; 1057 nFrames--;
@@ -1055,7 +1061,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
1055 } 1061 }
1056 // Dispatch output buffer 1062 // Dispatch output buffer
1057 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { 1063 if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) {
1058 dispatchOutputBuffer(omxNode, oBuffer, index); 1064 ASSERT_NO_FATAL_FAILURE(
1065 dispatchOutputBuffer(omxNode, oBuffer, index));
1059 oQueued = true; 1066 oQueued = true;
1060 } 1067 }
1061 // Reset Counters when either input or output buffer is dispatched 1068 // Reset Counters when either input or output buffer is dispatched
@@ -1064,8 +1071,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
1064 else 1071 else
1065 timeOut--; 1072 timeOut--;
1066 if (timeOut == 0) { 1073 if (timeOut == 0) {
1067 EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; 1074 ASSERT_TRUE(false) << "Wait on Input/Output is found indefinite";
1068 break;
1069 } 1075 }
1070 // Runtime Param Configuration 1076 // Runtime Param Configuration
1071 if (ipCount == 15) { 1077 if (ipCount == 15) {
@@ -1137,7 +1143,7 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
1137 xFramerate, eColorFormat); 1143 xFramerate, eColorFormat);
1138 1144
1139 sp<DummyBufferSource> buffersource = new DummyBufferSource(omxNode); 1145 sp<DummyBufferSource> buffersource = new DummyBufferSource(omxNode);
1140 EXPECT_NE(buffersource, nullptr); 1146 ASSERT_NE(buffersource, nullptr);
1141 status = omxNode->setInputSurface(buffersource); 1147 status = omxNode->setInputSurface(buffersource);
1142 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1148 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1143 1149
@@ -1151,20 +1157,20 @@ TEST_F(VideoEncHidlTest, BufferSourceCallBacks) {
1151 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1157 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1152 1158
1153 // set state to idle 1159 // set state to idle
1154 changeStateLoadedtoIdle(omxNode, observer, &buffersource->iBuffer, 1160 ASSERT_NO_FATAL_FAILURE(changeStateLoadedtoIdle(
1155 &buffersource->oBuffer, kPortIndexInput, 1161 omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
1156 kPortIndexOutput, portMode); 1162 kPortIndexInput, kPortIndexOutput, portMode));
1157 // set state to executing 1163 // set state to executing
1158 changeStateIdletoExecute(omxNode, observer); 1164 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1159 testEOS(omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer, 1165 ASSERT_NO_FATAL_FAILURE(testEOS(omxNode, observer, &buffersource->iBuffer,
1160 false, eosFlag); 1166 &buffersource->oBuffer, false, eosFlag));
1161 // set state to idle 1167 // set state to idle
1162 changeStateExecutetoIdle(omxNode, observer, &buffersource->iBuffer, 1168 ASSERT_NO_FATAL_FAILURE(changeStateExecutetoIdle(
1163 &buffersource->oBuffer); 1169 omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer));
1164 // set state to executing 1170 // set state to executing
1165 changeStateIdletoLoaded(omxNode, observer, &buffersource->iBuffer, 1171 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(
1166 &buffersource->oBuffer, kPortIndexInput, 1172 omxNode, observer, &buffersource->iBuffer, &buffersource->oBuffer,
1167 kPortIndexOutput); 1173 kPortIndexInput, kPortIndexOutput));
1168 // test for callbacks 1174 // test for callbacks
1169 EXPECT_EQ(buffersource->callback, 31); 1175 EXPECT_EQ(buffersource->callback, 31);
1170} 1176}
@@ -1218,8 +1224,9 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
1218 1224
1219 // Configure output port 1225 // Configure output port
1220 uint32_t nBitRate = 512000; 1226 uint32_t nBitRate = 512000;
1221 setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat, 1227 ASSERT_NO_FATAL_FAILURE(
1222 nFrameWidth, nFrameHeight, nBitRate, xFramerate); 1228 setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
1229 nFrameWidth, nFrameHeight, nBitRate, xFramerate));
1223 setRefreshPeriod(omxNode, kPortIndexOutput, 0); 1230 setRefreshPeriod(omxNode, kPortIndexOutput, 0);
1224 1231
1225 unsigned int index; 1232 unsigned int index;
@@ -1255,27 +1262,32 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
1255 android::Vector<BufferInfo> iBuffer, oBuffer; 1262 android::Vector<BufferInfo> iBuffer, oBuffer;
1256 1263
1257 // set state to idle 1264 // set state to idle
1258 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1265 ASSERT_NO_FATAL_FAILURE(
1259 kPortIndexInput, kPortIndexOutput, portMode); 1266 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
1267 kPortIndexInput, kPortIndexOutput, portMode));
1260 // set state to executing 1268 // set state to executing
1261 changeStateIdletoExecute(omxNode, observer); 1269 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1262 1270
1263 eleStream.open(mURL, std::ifstream::binary); 1271 eleStream.open(mURL, std::ifstream::binary);
1264 ASSERT_EQ(eleStream.is_open(), true); 1272 ASSERT_EQ(eleStream.is_open(), true);
1265 encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput, 1273 ASSERT_NO_FATAL_FAILURE(encodeNFrames(
1266 &iBuffer, &oBuffer, 32, xFramerate, 1274 omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
1267 (nFrameWidth * nFrameHeight * 3) >> 1, eleStream, 1275 &oBuffer, 32, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
1268 &timestampUslist); 1276 eleStream, &timestampUslist));
1269 eleStream.close(); 1277 eleStream.close();
1270 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer); 1278 ASSERT_NO_FATAL_FAILURE(
1271 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); 1279 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer));
1280 ASSERT_NO_FATAL_FAILURE(
1281 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
1272 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true); 1282 if (timestampDevTest) EXPECT_EQ(timestampUslist.empty(), true);
1273 1283
1274 // set state to idle 1284 // set state to idle
1275 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1285 ASSERT_NO_FATAL_FAILURE(
1286 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1276 // set state to executing 1287 // set state to executing
1277 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1288 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1278 kPortIndexInput, kPortIndexOutput); 1289 &oBuffer, kPortIndexInput,
1290 kPortIndexOutput));
1279} 1291}
1280 1292
1281// test raw stream encode (input is ANW buffers) 1293// test raw stream encode (input is ANW buffers)
@@ -1304,9 +1316,9 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
1304 1316
1305 // Configure output port 1317 // Configure output port
1306 uint32_t nBitRate = 512000; 1318 uint32_t nBitRate = 512000;
1307 setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat, 1319 ASSERT_NO_FATAL_FAILURE(
1308 nFrameWidth, nFrameHeight, nBitRate, xFramerate); 1320 setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
1309 1321 nFrameWidth, nFrameHeight, nBitRate, xFramerate));
1310 // CreateInputSurface 1322 // CreateInputSurface
1311 EXPECT_TRUE(omx->createInputSurface( 1323 EXPECT_TRUE(omx->createInputSurface(
1312 [&](android::hardware::media::omx::V1_0::Status _s, 1324 [&](android::hardware::media::omx::V1_0::Status _s,
@@ -1413,28 +1425,32 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
1413 1425
1414 android::Vector<BufferInfo> iBuffer, oBuffer; 1426 android::Vector<BufferInfo> iBuffer, oBuffer;
1415 // set state to idle 1427 // set state to idle
1416 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1428 ASSERT_NO_FATAL_FAILURE(
1417 kPortIndexInput, kPortIndexOutput, portMode); 1429 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
1430 kPortIndexInput, kPortIndexOutput, portMode));
1418 // set state to executing 1431 // set state to executing
1419 changeStateIdletoExecute(omxNode, observer); 1432 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1420 1433
1421 eleStream.open(mURL, std::ifstream::binary); 1434 eleStream.open(mURL, std::ifstream::binary);
1422 ASSERT_EQ(eleStream.is_open(), true); 1435 ASSERT_EQ(eleStream.is_open(), true);
1423 encodeNFrames(omxNode, observer, kPortIndexInput, kPortIndexOutput, 1436 ASSERT_NO_FATAL_FAILURE(encodeNFrames(
1424 &iBuffer, &oBuffer, 1024, xFramerate, 1437 omxNode, observer, kPortIndexInput, kPortIndexOutput, &iBuffer,
1425 (nFrameWidth * nFrameHeight * 3) >> 1, eleStream, nullptr, 1438 &oBuffer, 1024, xFramerate, (nFrameWidth * nFrameHeight * 3) >> 1,
1426 false, true, producer, listener); 1439 eleStream, nullptr, false, true, producer, listener));
1427 eleStream.close(); 1440 eleStream.close();
1428 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true, 1441 ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
1429 listener); 1442 &oBuffer, true, listener));
1430 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); 1443 ASSERT_NO_FATAL_FAILURE(
1444 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
1431 1445
1432 // set state to idle 1446 // set state to idle
1433 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1447 ASSERT_NO_FATAL_FAILURE(
1448 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1434 EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); 1449 EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
1435 // set state to executing 1450 // set state to executing
1436 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1451 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1437 kPortIndexInput, kPortIndexOutput); 1452 &oBuffer, kPortIndexInput,
1453 kPortIndexOutput));
1438 1454
1439 returnval = producer->disconnect( 1455 returnval = producer->disconnect(
1440 NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API); 1456 NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);
@@ -1528,24 +1544,28 @@ TEST_F(VideoEncHidlTest, EncodeTestEOS) {
1528 1544
1529 android::Vector<BufferInfo> iBuffer, oBuffer; 1545 android::Vector<BufferInfo> iBuffer, oBuffer;
1530 // set state to idle 1546 // set state to idle
1531 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer, 1547 ASSERT_NO_FATAL_FAILURE(
1532 kPortIndexInput, kPortIndexOutput, portMode); 1548 changeStateLoadedtoIdle(omxNode, observer, &iBuffer, &oBuffer,
1549 kPortIndexInput, kPortIndexOutput, portMode));
1533 // set state to executing 1550 // set state to executing
1534 changeStateIdletoExecute(omxNode, observer); 1551 ASSERT_NO_FATAL_FAILURE(changeStateIdletoExecute(omxNode, observer));
1535 1552
1536 // send EOS 1553 // send EOS
1537 status = source->signalEndOfInputStream(); 1554 status = source->signalEndOfInputStream();
1538 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); 1555 ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
1539 waitOnInputConsumption(omxNode, observer, &iBuffer, &oBuffer, true, 1556 ASSERT_NO_FATAL_FAILURE(waitOnInputConsumption(omxNode, observer, &iBuffer,
1540 listener); 1557 &oBuffer, true, listener));
1541 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag); 1558 ASSERT_NO_FATAL_FAILURE(
1559 testEOS(omxNode, observer, &iBuffer, &oBuffer, false, eosFlag));
1542 1560
1543 // set state to idle 1561 // set state to idle
1544 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer); 1562 ASSERT_NO_FATAL_FAILURE(
1563 changeStateExecutetoIdle(omxNode, observer, &iBuffer, &oBuffer));
1545 EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers); 1564 EXPECT_EQ(portDef.nBufferCountActual, listener->freeBuffers);
1546 // set state to executing 1565 // set state to executing
1547 changeStateIdletoLoaded(omxNode, observer, &iBuffer, &oBuffer, 1566 ASSERT_NO_FATAL_FAILURE(changeStateIdletoLoaded(omxNode, observer, &iBuffer,
1548 kPortIndexInput, kPortIndexOutput); 1567 &oBuffer, kPortIndexInput,
1568 kPortIndexOutput));
1549 1569
1550 returnval = producer->disconnect( 1570 returnval = producer->disconnect(
1551 NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API); 1571 NATIVE_WINDOW_API_CPU, IGraphicBufferProducer::DisconnectMode::API);