Fixed the crash caused by color_format not being set to H264 or H265

This commit is contained in:
jj
2024-12-19 16:05:11 +08:00
parent ab1faaa3ec
commit 35405405aa
+14 -5
View File
@@ -1810,10 +1810,13 @@ bool OBCameraNode::decodeColorFrameToBuffer(const std::shared_ptr<ob::Frame> &fr
}
CHECK_NOTNULL(image_publishers_[COLOR]);
bool has_subscriber = image_publishers_[COLOR]->get_subscription_count() > 0;
if (camera_h26x_publishers_[COLOR] &&
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0) {
has_subscriber = true;
if (!camera_h26x_publishers_.empty()) {
if (camera_h26x_publishers_[COLOR] &&
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0) {
has_subscriber = true;
}
}
if (enable_colored_point_cloud_ && depth_registration_cloud_pub_->get_subscription_count() > 0) {
has_subscriber = true;
}
@@ -1909,8 +1912,12 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
has_subscriber =
has_subscriber || (metadata_publishers_.count(stream_index) &&
metadata_publishers_[stream_index]->get_subscription_count() > 0);
has_subscriber = has_subscriber || (camera_h26x_publishers_[COLOR] &&
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0);
if (!camera_h26x_publishers_.empty()) {
has_subscriber =
has_subscriber || (camera_h26x_publishers_[COLOR] &&
camera_h26x_publishers_[COLOR]->get_subscription_count() > 0);
}
if (!has_subscriber) {
return;
}
@@ -1989,7 +1996,9 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
publishMetadata(frame, stream_index, camera_info.header);
}
CHECK_NOTNULL(image_publishers_[stream_index]);
if (image_publishers_[stream_index]->get_subscription_count() == 0 &&
!camera_h26x_publishers_.empty() &&
(!camera_h26x_publishers_[COLOR] &&
camera_h26x_publishers_[COLOR]->get_subscription_count() == 0)) {
return;