Message ID | ZXt0yJ2dqUIn6Ari@duo.ucw.cz |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Pavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org> writes: > Without this patch, I get segfault instead of "Failed to get default > stream configuration" message. It works for me, but ... > Signed-off-by: Pavel Machek <pavel@ucw.cz> > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index bdc7bfe5..8a315bfd 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -1138,6 +1138,8 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo > */ > for ([[maybe_unused]] StreamRole role : roles) { > StreamConfiguration cfg{ StreamFormats{ formats } }; > + if (!formats.begin()->first) > + continue; ... shouldn't the condition be if (formats.empty()) ? And couldn't the check be applied on the whole loop (which looks weird to me anyway and the preceding todo comment most likely applies)? > cfg.pixelFormat = formats.begin()->first; > cfg.size = formats.begin()->second[0].max;
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index bdc7bfe5..8a315bfd 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1138,6 +1138,8 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo */ for ([[maybe_unused]] StreamRole role : roles) { StreamConfiguration cfg{ StreamFormats{ formats } }; + if (!formats.begin()->first) + continue; cfg.pixelFormat = formats.begin()->first; cfg.size = formats.begin()->second[0].max;
Without this patch, I get segfault instead of "Failed to get default stream configuration" message. Signed-off-by: Pavel Machek <pavel@ucw.cz>