mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
libcamera: device_enumerator: Reference-count MediaDevice instances
The MediaDevice class will be the entry point to hot-unplug, as it corresponds to the kernel devices that will report device removal events. The class will signal media device disconnection to pipeline handlers, which will clean up resources as a result. This can't be performed synchronously as references may exist to the related Camera objects in applications. The MediaDevice object thus needs to be reference-counted in order to support unplugging, as otherwise pipeline handlers would be required to drop all the references to the media device they have borrowed synchronously with the disconnection signal handler, which would be very error prone (if even possible at all in a sane way). Handle MedieDevice instances with std::shared_ptr<> to support this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
5b02e03199
commit
4f043b05e7
7 changed files with 23 additions and 27 deletions
|
@ -240,7 +240,7 @@ class MediaDeviceLinkTest : public Test
|
|||
|
||||
private:
|
||||
unique_ptr<DeviceEnumerator> enumerator;
|
||||
MediaDevice *dev_;
|
||||
shared_ptr<MediaDevice> dev_;
|
||||
};
|
||||
|
||||
TEST_REGISTER(MediaDeviceLinkTest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue