Skip to content

Frame queue per stream, not per extension - #12575

Merged
OhadMeir merged 3 commits into
realsenseai:developmentfrom
OhadMeir:development
Jan 18, 2024
Merged

Frame queue per stream, not per extension#12575
OhadMeir merged 3 commits into
realsenseai:developmentfrom
OhadMeir:development

Conversation

@OhadMeir

@OhadMeir OhadMeir commented Jan 15, 2024

Copy link
Copy Markdown
Contributor

Currently frame archives are created per extension type. There are several streams that use RS2_EXTENSION_VIDEO_FRAME and the queue might get full, especially if a syncher is involved.

This PR creates archives also based on the stream type, so IR1+2 still share a queue but they come together and don't have to wait in the syncher.

Tracked on [RSDEV-599]

@OhadMeir OhadMeir changed the title Development Frame queue per stream, not per extension Jan 15, 2024
@OhadMeir
OhadMeir force-pushed the development branch 2 times, most recently from f49d17f to 9bc101c Compare January 17, 2024 07:50
@OhadMeir
OhadMeir marked this pull request as ready for review January 17, 2024 08:42
@OhadMeir
OhadMeir requested a review from Nir-Az January 17, 2024 08:43
Comment thread src/source.h Outdated
{
public:
frame_source(uint32_t max_publish_list_size = 16);
//using stream_uid = std::pair< rs2_stream, int >; // Stream type and index

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread src/source.cpp
Comment thread src/source.cpp Outdated
return _archive[RS2_EXTENSION_VIDEO_FRAME]->begin_callback();
// return _archive[RS2_EXTENSION_DEPTH_FRAME]->begin_callback();
if( id.second >= RS2_EXTENSION_COUNT )
id.first = RS2_STREAM_COUNT; // For added extensions like GPU accelerated frames

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes needed.
When adding an extension we need to create the archive because add_extension is templated with the archive type. At that stage we don't know the stream type that will be used, but cannot keep the type for later allocation.
When using the allocated archive we need to find it with the same key.

Comment thread src/source.cpp Outdated
if( it == _archive.end() )
{
create_archive( id );
it = _archive.find( id ); // Now will successfully find

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verify if we can optimize

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Optimized. create_archive now returns iterator to new archive.

Comment thread src/source.cpp
Comment thread src/source.cpp Outdated
throw wrong_api_call_sequence_exception( "Requested frame type is not supported!" );
{
create_archive( id );
it = _archive.find( id ); // Now will successfully find

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Optimized

@Nir-Az
Nir-Az self-requested a review January 17, 2024 10:35

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Small comments

@OhadMeir
OhadMeir merged commit e753ab7 into realsenseai:development Jan 18, 2024
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