diff options
author | Changyeon Jo <changyeon@google.com> | 2021-11-08 08:12:33 -0800 |
---|---|---|
committer | Changyeon Jo <changyeon@google.com> | 2023-10-18 20:40:53 +0000 |
commit | 912b16f8c5f53384958f65fdc4d3fef7d8481bd2 (patch) | |
tree | e53c68afc8720eec6f09023754cb5f28bbded760 | |
parent | ab786012741f3bb469c589999e73d80b0ba662c4 (diff) | |
download | interfaces-912b16f8c5f53384958f65fdc4d3fef7d8481bd2.tar.gz |
Update CameraStreamBuffering test and correct instance name
- CameraStreamBuffering test is modified to use the minimum number of
frame buffers that is required to run a camera pipeline for a single
client instead of using an arbitrarily chosen number, which may not
work for certain device implementations.
- Fix a name of v1.0 EvsManager implementation in
VtsHalEvsV1_0TargetTest.cpp
Bug: 305642713
Test: atest VtsHalEvsV1_0TargetTest and
atest VtsHalEvsV1_1TargetTest
Change-Id: Ieec986dbdf947311e0bc86871432da8a988d37ad
(cherry picked from commit 2d8834dc96bd6980fc0ab1917bf8485730e5a584)
-rw-r--r-- | automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp | 31 | ||||
-rw-r--r-- | automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp | 24 |
2 files changed, 40 insertions, 15 deletions
diff --git a/automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp b/automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp index 1fd0b61c31..cf7033c242 100644 --- a/automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp +++ b/automotive/evs/1.0/vts/functional/VtsHalEvsV1_0TargetTest.cpp @@ -65,8 +65,8 @@ public: ASSERT_NE(pEnumerator.get(), nullptr); - // "default" is reserved for EVS manager. - constexpr static char kEvsManagerName[] = "default"; + // "legacy_sw/0" is reserved for EVS manager v1.0 implementation. + constexpr static char kEvsManagerName[] = "legacy_sw/0"; mIsHwModule = service_name.compare(kEvsManagerName); } @@ -363,8 +363,14 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) { TEST_P(EvsHidlTest, CameraStreamBuffering) { ALOGI("Starting CameraStreamBuffering test"); - // Arbitrary constant (should be > 1 and not too big) - static const unsigned int kBuffersToHold = 2; + // Maximum number of frames in flight this test case will attempt. This test + // case chooses an arbitrary number that is large enough to run a camera + // pipeline for a single client. + constexpr unsigned int kMaxBuffersToHold = 20; + + // Initial value for setMaxFramesInFlight() call. This number should be + // greater than 1. + unsigned int buffersToHold = 2; // Get the camera list loadCameraList(); @@ -380,9 +386,16 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { EXPECT_EQ(EvsResult::BUFFER_NOT_AVAILABLE, badResult); // Now ask for exactly two buffers in flight as we'll test behavior in that case - Return<EvsResult> goodResult = pCam->setMaxFramesInFlight(kBuffersToHold); - EXPECT_EQ(EvsResult::OK, goodResult); - + // Find the minimum number of buffers to run a target camera. + while (buffersToHold < kMaxBuffersToHold) { + Return<EvsResult> goodResult = pCam->setMaxFramesInFlight(buffersToHold); + if (goodResult == EvsResult::OK) { + break; + } + + ++buffersToHold; + } + EXPECT_LE(buffersToHold, kMaxBuffersToHold); // Set up a frame receiver object which will fire up its own thread. sp<FrameHandler> frameHandler = new FrameHandler(pCam, cam, @@ -398,7 +411,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { sleep(2); // 1 second should be enough for at least 5 frames to be delivered worst case unsigned framesReceived = 0; frameHandler->getFramesCounters(&framesReceived, nullptr); - ASSERT_EQ(kBuffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; + ASSERT_EQ(buffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; // Give back one buffer @@ -409,7 +422,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { // filled since we require 10fps minimum -- but give a 10% allowance just in case. usleep(110 * kMillisecondsToMicroseconds); frameHandler->getFramesCounters(&framesReceived, nullptr); - EXPECT_EQ(kBuffersToHold+1, framesReceived) << "Stream should've resumed"; + EXPECT_EQ(buffersToHold+1, framesReceived) << "Stream should've resumed"; // Even when the camera pointer goes out of scope, the FrameHandler object will // keep the stream alive unless we tell it to shutdown. diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp index 5688529df9..12eac0e975 100644 --- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp +++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp @@ -534,8 +534,14 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) { TEST_P(EvsHidlTest, CameraStreamBuffering) { LOG(INFO) << "Starting CameraStreamBuffering test"; - // Arbitrary constant (should be > 1 and not too big) - static const unsigned int kBuffersToHold = 2; + // Maximum number of frames in flight this test case will attempt. This test + // case chooses an arbitrary number that is large enough to run a camera + // pipeline for a single client. + constexpr unsigned int kMaxBuffersToHold = 20; + + // Initial value for setMaxFramesInFlight() call. This number should be + // greater than 1. + unsigned int buffersToHold = 2; // Get the camera list loadCameraList(); @@ -566,9 +572,15 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { EXPECT_EQ(EvsResult::BUFFER_NOT_AVAILABLE, badResult); // Now ask for exactly two buffers in flight as we'll test behavior in that case - Return<EvsResult> goodResult = pCam->setMaxFramesInFlight(kBuffersToHold); - EXPECT_EQ(EvsResult::OK, goodResult); + while (buffersToHold < kMaxBuffersToHold) { + Return<EvsResult> goodResult = pCam->setMaxFramesInFlight(buffersToHold); + if (goodResult == EvsResult::OK) { + break; + } + ++buffersToHold; + } + EXPECT_LE(buffersToHold, kMaxBuffersToHold); // Set up a frame receiver object which will fire up its own thread. sp<FrameHandler> frameHandler = new FrameHandler(pCam, cam, @@ -584,7 +596,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { sleep(1); // 1 second should be enough for at least 5 frames to be delivered worst case unsigned framesReceived = 0; frameHandler->getFramesCounters(&framesReceived, nullptr); - ASSERT_EQ(kBuffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; + ASSERT_EQ(buffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; // Give back one buffer @@ -595,7 +607,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { // filled since we require 10fps minimum -- but give a 10% allowance just in case. usleep(110 * kMillisecondsToMicroseconds); frameHandler->getFramesCounters(&framesReceived, nullptr); - EXPECT_EQ(kBuffersToHold+1, framesReceived) << "Stream should've resumed"; + EXPECT_EQ(buffersToHold+1, framesReceived) << "Stream should've resumed"; // Even when the camera pointer goes out of scope, the FrameHandler object will // keep the stream alive unless we tell it to shutdown. |