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

Set DDS processing block settings #13625

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 24 additions & 0 deletions src/dds/rs-dds-sensor-proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <src/proc/color-formats-converter.h>

#include <rsutils/string/nocase.h>
#include <rsutils/json.h>
using rsutils::json;

Expand Down Expand Up @@ -664,7 +665,11 @@ void dds_sensor_proxy::add_processing_block( std::string const & filter_name )
if( ! ppb )
LOG_WARNING( "Unsupported processing block '" + filter_name + "' received" );
else
{
// Currently processing block factory does not support block settings, add here if needed.
add_processing_block_settings( filter_name, ppb );
super::add_processing_block( ppb );
}
}
catch( std::exception const & e )
{
Expand All @@ -673,5 +678,24 @@ void dds_sensor_proxy::add_processing_block( std::string const & filter_name )
}
}

void dds_sensor_proxy::add_processing_block_settings( const std::string & filter_name,
std::shared_ptr< librealsense::processing_block_interface > & ppb ) const
{
if( rsutils::string::nocase_equal( filter_name, "Decimation Filter" ) )
if( !ppb->supports_option( RS2_OPTION_STREAM_FILTER ) )
LOG_ERROR( "Decimation Filter does not support stream filter option" );
else
if( rsutils::string::nocase_equal( get_name(), "RGB Camera" ) )
{
ppb->get_option( RS2_OPTION_STREAM_FILTER ).set( RS2_STREAM_COLOR );
ppb->get_option( RS2_OPTION_STREAM_FORMAT_FILTER ).set( RS2_FORMAT_ANY );
}
else
{
ppb->get_option( RS2_OPTION_STREAM_FILTER ).set( RS2_STREAM_DEPTH );
ppb->get_option( RS2_OPTION_STREAM_FORMAT_FILTER ).set( RS2_FORMAT_Z16 );
}
}


} // namespace librealsense
3 changes: 3 additions & 0 deletions src/dds/rs-dds-sensor-proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class dds_sensor_proxy : public software_sensor
virtual void add_no_metadata( frame *, streaming_impl & );
virtual void add_frame_metadata( frame *, rsutils::json const & metadata, streaming_impl & );

void add_processing_block_settings( const std::string & filter_name,
std::shared_ptr< librealsense::processing_block_interface > & ppb ) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need here shared_ptr by reference? It seems to me that you want it by value, so that the copy ctor works, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, no need to create a new shared_ptr and update the reference count.
It's just a helper function that uses the shared_ptr of the caller, we don't want to store it.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok


friend class dds_device_proxy; // Currently calls handle_new_metadata
};

Expand Down
Loading