Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camerad: fix tearing when hitting frame timeout #34514

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/camerad/cameras/spectra.cc
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,12 @@ void SpectraCamera::enqueue_buffer(int i, bool dp) {
sync_wait.timeout_ms = 100;
ret = do_sync_control(m->cam_sync_fd, CAM_SYNC_WAIT, &sync_wait, sizeof(sync_wait));
if (ret != 0) {
// TODO: handle frame drop cleanly
// when this happens, it messes up future frames
clear_req_queue();
LOGE("failed to wait for sync: %d %d", ret, sync_wait.sync_obj);
}
buf.frame_metadata[i].timestamp_end_of_isp = (uint64_t)nanos_since_boot();
buf.frame_metadata[i].timestamp_eof = buf.frame_metadata[i].timestamp_sof + sensor->readout_time_ns;
if (dp) {
if (dp && ret == 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with a low timeout (rand() % 30 + 10), without this, you would still sometimes see occasional tearing due to using the incomplete frame, even if we cleared the request queue

buf.queue(i);
}

Expand Down