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

Added functionality of no throw wait_for_frame #2049

Closed
wants to merge 3 commits into from

Conversation

belkinirena
Copy link
Contributor

@belkinirena belkinirena commented Jul 12, 2018

-Added API of try_wait_for_frame/s to frame_queue, syncer and pipeline.
The function has the same functionality as wait_for_frame except in case of timeout try_wait_for_frame
returns false instead of throwing exception.
-Fixed bug of high CPU utilization in realsense-viewer

Wait for frames CPU usage Close delay
1 23% Immediate
10 20% Immediate
20 15% Immediate
30 10% Immediate
100 10% Immediate
1000 10% 1 sec

Tracked on: DSO-9381

-Added API of try_wait_for_frame/s to frame_queue, syncer and pipeline.
The function has the same functionality as wait_for_frame except in case of timeout try_wait_for_frame returns false instead of throwing exception.
-Fixed bug of high CPU utilization in realsense-viewer

Tracked on: DSO-9381
@@ -619,6 +619,37 @@ namespace librealsense
return false;
}

bool pipeline::try_wait_for_frames(frame_holder* frame, unsigned int timeout_ms)
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like duplicate code, can we reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought about adding try catch for run-time errors instead of duplicating the code, but than I assume that wait_for_frames throws only run-time exceptions in case of timeout, don't want to catch exception of invalid input for example. Is this a reasonable assumption?

Copy link
Contributor

Choose a reason for hiding this comment

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

What about the other way around - wait_for_frames calls try_wait_for_frames and throws if it returns false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case of device disconnected should I return false or throw exception in try_wait_for frames? I assumed that I should return false, I can't differ between the two cases in which run-time exception is thrown

matkatz and others added 2 commits July 12, 2018 10:05
* refactor pipeline resolve
* remove presets from pipeline config
* add make_context to pipeline tests
* pipeline wildcard streams test added
* fix sort_best_quality
* remove default streams filter from pipeline
* remove make default
* resolve default configurations first
* override set_marker
* set default configurations for each device
@belkinirena belkinirena deleted the try_wff branch July 13, 2018 09:07
@belkinirena
Copy link
Contributor Author

A new pull request was opened #2055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants