mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: libcamera: move shared_ptr to avoid copy
This commit is contained in:
parent
ba04a0f936
commit
442a0c54ea
1 changed files with 3 additions and 3 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <libcamera/camera.h>
|
#include <libcamera/camera.h>
|
||||||
#include <libcamera/camera_manager.h>
|
#include <libcamera/camera_manager.h>
|
||||||
|
|
@ -127,7 +127,7 @@ static struct device *add_device(struct impl *impl, std::shared_ptr<Camera> came
|
||||||
id = impl->n_devices++;
|
id = impl->n_devices++;
|
||||||
device = &impl->devices[id];
|
device = &impl->devices[id];
|
||||||
device->id = id;
|
device->id = id;
|
||||||
device->camera = camera;
|
device->camera = std::move(camera);
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +193,7 @@ void Impl::addCamera(std::shared_ptr<Camera> camera)
|
||||||
if ((device = find_device(impl, camera.get())) != NULL)
|
if ((device = find_device(impl, camera.get())) != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((device = add_device(impl, camera)) == NULL)
|
if ((device = add_device(impl, std::move(camera))) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
emit_object_info(impl, device);
|
emit_object_info(impl, device);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue