mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
spa: libcamera: take raw pointer to avoid shared_ptr copy
This commit is contained in:
parent
9370fbee3d
commit
ba04a0f936
1 changed files with 4 additions and 4 deletions
|
|
@ -131,11 +131,11 @@ static struct device *add_device(struct impl *impl, std::shared_ptr<Camera> came
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device *find_device(struct impl *impl, std::shared_ptr<Camera> camera)
|
static struct device *find_device(struct impl *impl, const Camera *camera)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < impl->n_devices; 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 &impl->devices[i];
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -190,7 +190,7 @@ void Impl::addCamera(std::shared_ptr<Camera> camera)
|
||||||
|
|
||||||
spa_log_info(impl->log, "new camera");
|
spa_log_info(impl->log, "new camera");
|
||||||
|
|
||||||
if ((device = find_device(impl, camera)) != NULL)
|
if ((device = find_device(impl, camera.get())) != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((device = add_device(impl, camera)) == NULL)
|
if ((device = add_device(impl, camera)) == NULL)
|
||||||
|
|
@ -205,7 +205,7 @@ void Impl::removeCamera(std::shared_ptr<Camera> camera)
|
||||||
struct device *device;
|
struct device *device;
|
||||||
|
|
||||||
spa_log_info(impl->log, "camera removed");
|
spa_log_info(impl->log, "camera removed");
|
||||||
if ((device = find_device(impl, camera)) == NULL)
|
if ((device = find_device(impl, camera.get())) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
remove_device(impl, device);
|
remove_device(impl, device);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue