mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 17:45:06 +03:00
libcamera: pipeline: uvcvideo: Fix crash when default entity is not found
Commite441f2c7f4
("libcamera: pipeline: uvcvideo: Add controls support") broke handling of UVC devices without a default entity by turning the error check into an always false check. Fix it. Fixes:e441f2c7f4
("libcamera: pipeline: uvcvideo: Add controls support") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
89dc54af09
commit
a023aed1aa
1 changed files with 9 additions and 9 deletions
|
@ -296,19 +296,19 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
|
||||||
std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);
|
std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);
|
||||||
|
|
||||||
/* Locate and initialise the camera data with the default video node. */
|
/* Locate and initialise the camera data with the default video node. */
|
||||||
for (MediaEntity *entity : media->entities()) {
|
const std::vector<MediaEntity *> &entities = media->entities();
|
||||||
if (entity->flags() & MEDIA_ENT_FL_DEFAULT) {
|
auto entity = std::find_if(entities.begin(), entities.end(),
|
||||||
if (data->init(entity))
|
[](MediaEntity *entity) {
|
||||||
return false;
|
return entity->flags() & MEDIA_ENT_FL_DEFAULT;
|
||||||
break;
|
});
|
||||||
}
|
if (entity == entities.end()) {
|
||||||
}
|
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
LOG(UVC, Error) << "Could not find a default video device";
|
LOG(UVC, Error) << "Could not find a default video device";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->init(*entity))
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Create and register the camera. */
|
/* Create and register the camera. */
|
||||||
std::set<Stream *> streams{ &data->stream_ };
|
std::set<Stream *> streams{ &data->stream_ };
|
||||||
std::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams);
|
std::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue