mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-12 07:19:50 +08:00
Fixed the crash caused by color_format not being set to H264 or H265
This commit is contained in:
@@ -1810,10 +1810,13 @@ bool OBCameraNode::decodeColorFrameToBuffer(const std::shared_ptr<ob::Frame> &fr
|
|||||||
}
|
}
|
||||||
CHECK_NOTNULL(image_publishers_[COLOR]);
|
CHECK_NOTNULL(image_publishers_[COLOR]);
|
||||||
bool has_subscriber = image_publishers_[COLOR]->get_subscription_count() > 0;
|
bool has_subscriber = image_publishers_[COLOR]->get_subscription_count() > 0;
|
||||||
if (camera_h26x_publishers_[COLOR] &&
|
if (!camera_h26x_publishers_.empty()) {
|
||||||
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0) {
|
if (camera_h26x_publishers_[COLOR] &&
|
||||||
has_subscriber = true;
|
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0) {
|
||||||
|
has_subscriber = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_colored_point_cloud_ && depth_registration_cloud_pub_->get_subscription_count() > 0) {
|
if (enable_colored_point_cloud_ && depth_registration_cloud_pub_->get_subscription_count() > 0) {
|
||||||
has_subscriber = true;
|
has_subscriber = true;
|
||||||
}
|
}
|
||||||
@@ -1909,8 +1912,12 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
|
|||||||
has_subscriber =
|
has_subscriber =
|
||||||
has_subscriber || (metadata_publishers_.count(stream_index) &&
|
has_subscriber || (metadata_publishers_.count(stream_index) &&
|
||||||
metadata_publishers_[stream_index]->get_subscription_count() > 0);
|
metadata_publishers_[stream_index]->get_subscription_count() > 0);
|
||||||
has_subscriber = has_subscriber || (camera_h26x_publishers_[COLOR] &&
|
if (!camera_h26x_publishers_.empty()) {
|
||||||
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0);
|
has_subscriber =
|
||||||
|
has_subscriber || (camera_h26x_publishers_[COLOR] &&
|
||||||
|
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!has_subscriber) {
|
if (!has_subscriber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1989,7 +1996,9 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
|
|||||||
publishMetadata(frame, stream_index, camera_info.header);
|
publishMetadata(frame, stream_index, camera_info.header);
|
||||||
}
|
}
|
||||||
CHECK_NOTNULL(image_publishers_[stream_index]);
|
CHECK_NOTNULL(image_publishers_[stream_index]);
|
||||||
|
|
||||||
if (image_publishers_[stream_index]->get_subscription_count() == 0 &&
|
if (image_publishers_[stream_index]->get_subscription_count() == 0 &&
|
||||||
|
!camera_h26x_publishers_.empty() &&
|
||||||
(!camera_h26x_publishers_[COLOR] &&
|
(!camera_h26x_publishers_[COLOR] &&
|
||||||
camera_h26x_publishers_[COLOR]->get_subscription_count() == 0)) {
|
camera_h26x_publishers_[COLOR]->get_subscription_count() == 0)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user