From ba04a0f936cce254e18c8f643063f5b0c0779ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 9 Sep 2022 17:04:16 +0200 Subject: [PATCH] spa: libcamera: take raw pointer to avoid shared_ptr copy --- spa/plugins/libcamera/libcamera-manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-manager.cpp b/spa/plugins/libcamera/libcamera-manager.cpp index c8daf8cde..c8b38b78d 100644 --- a/spa/plugins/libcamera/libcamera-manager.cpp +++ b/spa/plugins/libcamera/libcamera-manager.cpp @@ -131,11 +131,11 @@ static struct device *add_device(struct impl *impl, std::shared_ptr came return device; } -static struct device *find_device(struct impl *impl, std::shared_ptr camera) +static struct device *find_device(struct impl *impl, const Camera *camera) { uint32_t i; for (i = 0; i < impl->n_devices; i++) { - if (impl->devices[i].camera == camera) + if (impl->devices[i].camera.get() == camera) return &impl->devices[i]; } return NULL; @@ -190,7 +190,7 @@ void Impl::addCamera(std::shared_ptr camera) spa_log_info(impl->log, "new camera"); - if ((device = find_device(impl, camera)) != NULL) + if ((device = find_device(impl, camera.get())) != NULL) return; if ((device = add_device(impl, camera)) == NULL) @@ -205,7 +205,7 @@ void Impl::removeCamera(std::shared_ptr camera) struct device *device; spa_log_info(impl->log, "camera removed"); - if ((device = find_device(impl, camera)) == NULL) + if ((device = find_device(impl, camera.get())) == NULL) return; remove_device(impl, device);