st/p,t/common: Protect tracker-creation calls

This commit is contained in:
Ryan Pavlik 2023-05-16 16:59:05 -05:00 committed by Jakob Bornecrantz
parent cd79bef0cf
commit ae6b0ad445
2 changed files with 10 additions and 6 deletions

View file

@ -170,11 +170,13 @@ p_factory_ensure_frameserver(struct p_factory *fact)
struct xrt_colour_rgb_f32 rgb[2] = {{1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}}; struct xrt_colour_rgb_f32 rgb[2] = {{1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}};
// We create the two psmv trackers up front, but don't start them. // We create the two psmv trackers up front, but don't start them.
// clang-format off #if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSMV)
t_psmv_create(&fact->xfctx, &rgb[0], fact->data, &fact->xtmv[0], &xsinks[0]); t_psmv_create(&fact->xfctx, &rgb[0], fact->data, &fact->xtmv[0], &xsinks[0]);
t_psmv_create(&fact->xfctx, &rgb[1], fact->data, &fact->xtmv[1], &xsinks[1]); t_psmv_create(&fact->xfctx, &rgb[1], fact->data, &fact->xtmv[1], &xsinks[1]);
#endif
#if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSVR)
t_psvr_create(&fact->xfctx, fact->data, &fact->xtvr, &xsinks[2]); t_psvr_create(&fact->xfctx, fact->data, &fact->xtvr, &xsinks[2]);
// clang-format on #endif
// Setup origin to the common one. // Setup origin to the common one.
fact->xtvr->origin = &fact->origin; fact->xtvr->origin = &fact->origin;
@ -318,7 +320,7 @@ p_factory_ensure_slam_frameserver(struct p_factory *fact)
static int static int
p_factory_create_tracked_psmv(struct xrt_tracking_factory *xfact, struct xrt_tracked_psmv **out_xtmv) p_factory_create_tracked_psmv(struct xrt_tracking_factory *xfact, struct xrt_tracked_psmv **out_xtmv)
{ {
#ifdef XRT_HAVE_OPENCV #if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSMV)
struct p_factory *fact = p_factory(xfact); struct p_factory *fact = p_factory(xfact);
struct xrt_tracked_psmv *xtmv = NULL; struct xrt_tracked_psmv *xtmv = NULL;
@ -347,7 +349,7 @@ p_factory_create_tracked_psmv(struct xrt_tracking_factory *xfact, struct xrt_tra
static int static int
p_factory_create_tracked_psvr(struct xrt_tracking_factory *xfact, struct xrt_tracked_psvr **out_xtvr) p_factory_create_tracked_psvr(struct xrt_tracking_factory *xfact, struct xrt_tracked_psvr **out_xtvr)
{ {
#ifdef XRT_HAVE_OPENCV #if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSVR)
struct p_factory *fact = p_factory(xfact); struct p_factory *fact = p_factory(xfact);
struct xrt_tracked_psvr *xtvr = NULL; struct xrt_tracked_psvr *xtvr = NULL;

View file

@ -130,11 +130,13 @@ setup_pipeline(struct xrt_prober *xp, struct build_state *build)
struct xrt_colour_rgb_f32 rgb[2] = {{1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}}; struct xrt_colour_rgb_f32 rgb[2] = {{1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}};
// We create the two psmv trackers up front, but don't start them. // We create the two psmv trackers up front, but don't start them.
// clang-format off #if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSMV)
t_psmv_create(build->xfctx, &rgb[0], data, &build->psmv_red, &xsinks[0]); t_psmv_create(build->xfctx, &rgb[0], data, &build->psmv_red, &xsinks[0]);
t_psmv_create(build->xfctx, &rgb[1], data, &build->psmv_purple, &xsinks[1]); t_psmv_create(build->xfctx, &rgb[1], data, &build->psmv_purple, &xsinks[1]);
#endif
#if defined(XRT_HAVE_OPENCV) && defined(XRT_BUILD_DRIVER_PSVR)
t_psvr_create(build->xfctx, data, &build->psvr, &xsinks[2]); t_psvr_create(build->xfctx, data, &build->psvr, &xsinks[2]);
// clang-format on #endif
// No longer needed. // No longer needed.
t_stereo_camera_calibration_reference(&data, NULL); t_stereo_camera_calibration_reference(&data, NULL);