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

Refactor pipeline resolve #2006

Merged
merged 32 commits into from
Jul 12, 2018

Conversation

matkatz
Copy link
Contributor

@matkatz matkatz commented Jul 5, 2018

Tracked on: DSO-9472,
Following-up on #1543

@dorodnic
Copy link
Contributor

It's finally green! 🎉

src/context.cpp Outdated
{
std::vector<tagged_profile> markers;
markers.push_back({ RS2_STREAM_COLOR, -1, 640, 480, RS2_FORMAT_RGB8, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT });
markers.push_back({ RS2_STREAM_DEPTH, -1, 640, 480, RS2_FORMAT_Z16, 30, profile_tag::PROFILE_TAG_SUPERSET | profile_tag::PROFILE_TAG_DEFAULT });
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not expect depth and infrared to be available on a platform camera

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it probably can also default to higher resolution... 1920x1080?

typedef enum profile_tag
{
PROFILE_TAG_ANY = 0,
PROFILE_TAG_SUPERSET = 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding comment:
PROFILE_TAG_SUPERSET // to be included in enable_all
PROFILE_TAG_DEFAULT // to be included in default pipeline start

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

platform::usb_spec ds5_device::get_usb_spec() const
{
if(!supports_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR))
return platform::usb_undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not USB3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is better to let the caller decide what to do in case usb type is unknown

@@ -37,6 +37,25 @@ namespace librealsense
ds5_advanced_mode_base(ds5_device::_hw_monitor, get_depth_sensor()) {}

std::shared_ptr<matcher> create_matcher(const frame_holder& frame) const override;

std::vector<tagged_profile> get_profiles_tags() const override
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion, to consider:
Profile tags are queries every time you call tag_profile, so the resulting vector will be created and re-created over and over again. This is only during start-up, but still.
Perhaps you can add another (non-virtual) getter that would fetch a lazy<std::vector<tagged_profile>> that would be initialized with lambda to get_profiles_tags?

@@ -79,7 +79,7 @@ namespace librealsense
assign_stream(_owner->_gpio_streams[p->get_stream_index()-1], p);
if (p->get_framerate() == 1000 &&
p->get_format() == RS2_FORMAT_MOTION_XYZ32F)
p->make_default();
get_device().tag_profile(p.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to ensure that library writer will not forget to call tag_profile on one of the camera profiles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually this "if" should be removed and added is a default stream.
for both this comment and the one above I can init the profiles on the device creation, but I guess that I will need to record everything again.

int min_version[ver_size];
std::sscanf(api_version.c_str(), "%d.%d.%d", &section_version[0], &section_version[1], &section_version[2]);
std::sscanf(min_api_version.c_str(), "%d.%d.%d", &min_version[0], &min_version[1], &min_version[2]);
for (int i = 0; i < ver_size; i++)
Copy link
Contributor

Choose a reason for hiding this comment

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

What if invalid string format will be passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

throw exception in case of bad format
done

@@ -403,6 +403,19 @@ namespace librealsense
select_api_version.bind(1, section_id);
select_api_version.bind(2, API_VERSION_KEY);
auto api_version = select_api_version()[0].get_string();
const int ver_size = 3;
int section_version[ver_size];
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe initialize with zeros?

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 -1

src/sensor.cpp Outdated
if (tag == profile_tag::PROFILE_TAG_ANY)
return *_profiles;

stream_profiles profiles;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming to something like result. profiles is confusing with _profiles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

{
auto it = std::find_if(begin(all_streams), end(all_streams), [d](const rs2::stream_profile profile)
{
return d == profile;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this work with regular find?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@dorodnic dorodnic merged commit e3021cc into IntelRealSense:development Jul 12, 2018
@matkatz matkatz deleted the refactor_pipeline_resolve branch December 23, 2018 07:57
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.

2 participants