Camera2: Tests: Fix CameraFrameTests to pass instead of failing and hanging.: DO NOT MERGE

Producer would wait for buffers to be released so it could dequeue into them.
Since the test never acquired/released buffers, it would run out, and then
the HAL would deadlock when trying to shutdown since the producing thread
would never finish.

Change-Id: I123f36d87a2e72a2c42d942c975c02b8bd3f9f1a
This commit is contained in:
Igor Murashkin 2012-12-18 13:40:32 -08:00
parent d887503095
commit 1f51808ad1

View file

@ -115,8 +115,18 @@ TEST_P(CameraFrameTest, GetFrame) {
for (int i = 0; i < GetParam(); ++i) {
ALOGV("Reading capture request %d", i);
ASSERT_EQ(OK, mDevice->waitForNextFrame(CAMERA_FRAME_TIMEOUT));
CameraMetadata frameMetadata;
ASSERT_EQ(OK, mDevice->getNextFrame(&frameMetadata));
// wait for buffer to be available
ASSERT_EQ(OK, mFrameListener->waitForFrame(CAMERA_FRAME_TIMEOUT));
ALOGV("We got the frame now");
// mark buffer consumed so producer can re-dequeue it
CpuConsumer::LockedBuffer imgBuffer;
ASSERT_EQ(OK, mCpuConsumer->lockNextBuffer(&imgBuffer));
ASSERT_EQ(OK, mCpuConsumer->unlockBuffer(imgBuffer));
}
}