Message ID | 20200616131244.70308-9-paul.elder@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Paul, Thank you for the patch. On Tue, Jun 16, 2020 at 10:12:37PM +0900, Paul Elder wrote: > If the camera configuration has been adjusted, validate it again to > ensure that it's valid, before configuring the camera with it. This shouldn't be needed, an adjusted configuration is supposed to be valid. If that's not the case, it's a bug in the pipeline handler (in which case a unit test should be added to catch this, in addition to fixing the bug). > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > src/v4l2/v4l2_camera.cpp | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp > index 2557320..fdbf461 100644 > --- a/src/v4l2/v4l2_camera.cpp > +++ b/src/v4l2/v4l2_camera.cpp > @@ -119,11 +119,18 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut, > LOG(V4L2Compat, Debug) << "Configuration invalid"; > return -EINVAL; > } > - if (validation == CameraConfiguration::Adjusted) > + if (validation == CameraConfiguration::Adjusted) { > LOG(V4L2Compat, Debug) << "Configuration adjusted"; > + validation = config_->validate(); > + if (validation != CameraConfiguration::Valid) { > + LOG(V4L2Compat, Error) > + << "Configuration adjusted but not valid"; > + return -EINVAL; > + } > + } > > - LOG(V4L2Compat, Debug) << "Validated configuration is: " > - << streamConfig.toString(); > + LOG(V4L2Compat, Debug) > + << "Validated configuration is: " << streamConfig.toString(); > > int ret = camera_->configure(config_.get()); > if (ret < 0)
diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp index 2557320..fdbf461 100644 --- a/src/v4l2/v4l2_camera.cpp +++ b/src/v4l2/v4l2_camera.cpp @@ -119,11 +119,18 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut, LOG(V4L2Compat, Debug) << "Configuration invalid"; return -EINVAL; } - if (validation == CameraConfiguration::Adjusted) + if (validation == CameraConfiguration::Adjusted) { LOG(V4L2Compat, Debug) << "Configuration adjusted"; + validation = config_->validate(); + if (validation != CameraConfiguration::Valid) { + LOG(V4L2Compat, Error) + << "Configuration adjusted but not valid"; + return -EINVAL; + } + } - LOG(V4L2Compat, Debug) << "Validated configuration is: " - << streamConfig.toString(); + LOG(V4L2Compat, Debug) + << "Validated configuration is: " << streamConfig.toString(); int ret = camera_->configure(config_.get()); if (ret < 0)
If the camera configuration has been adjusted, validate it again to ensure that it's valid, before configuring the camera with it. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/v4l2/v4l2_camera.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)