Camera: VTS: Fix fence fd double close am: 3ad137edbb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2539830 Change-Id: I6f75051e3ac3bf9d3976969ead45da306d2ff10a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
2603479470
3 changed files with 17 additions and 3 deletions
|
@ -148,7 +148,7 @@ void CameraAidlTest::waitForReleaseFence(
|
|||
const native_handle_t* releaseFenceHandle = bufferAndTimestamp.buffer.releaseFence;
|
||||
if (releaseFenceHandle != nullptr && releaseFenceHandle->numFds == 1 &&
|
||||
releaseFenceHandle->data[0] >= 0) {
|
||||
releaseFence = new android::Fence(releaseFenceHandle->data[0]);
|
||||
releaseFence = new android::Fence(dup(releaseFenceHandle->data[0]));
|
||||
}
|
||||
if (releaseFence && releaseFence->isValid()) {
|
||||
releaseFence->wait(/*ms*/ 300);
|
||||
|
|
|
@ -481,6 +481,20 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
|
|||
hasInputBuffer(hasInput),
|
||||
collectedResult(1, 10),
|
||||
expectedPhysicalResults(extraPhysicalResult) {}
|
||||
|
||||
~InFlightRequest() {
|
||||
for (auto& buffer : resultOutputBuffers) {
|
||||
native_handle_t* acquireFenceHandle = const_cast<native_handle_t*>(
|
||||
buffer.buffer.acquireFence);
|
||||
native_handle_close(acquireFenceHandle);
|
||||
native_handle_delete(acquireFenceHandle);
|
||||
|
||||
native_handle_t* releaseFenceHandle = const_cast<native_handle_t*>(
|
||||
buffer.buffer.releaseFence);
|
||||
native_handle_close(releaseFenceHandle);
|
||||
native_handle_delete(releaseFenceHandle);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static bool matchDeviceName(const std::string& deviceName, const std::string& providerType,
|
||||
|
|
|
@ -428,8 +428,8 @@ bool DeviceCb::processCaptureResultLocked(
|
|||
bufferId,
|
||||
outputBuffer,
|
||||
buffer.status,
|
||||
::android::makeFromAidl(buffer.acquireFence),
|
||||
::android::makeFromAidl(buffer.releaseFence)};
|
||||
::android::dupFromAidl(buffer.acquireFence),
|
||||
::android::dupFromAidl(buffer.releaseFence)};
|
||||
streamBufferAndTimestamp.timeStamp = systemTime();
|
||||
request->resultOutputBuffers.push_back(streamBufferAndTimestamp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue