[libcamera-devel] [PATCH] cam: capture: Stop stream when queueRequest fails

Helen Koike helen.koike at collabora.com
Tue Jun 25 18:23:53 CEST 2019


queueRequest is called after starting the stream.
If it fails, the stream should be stopped, otherwise it can get a
"Device or resource busy" error, due to VIDIOC_REQBUFS ioctls being
called after VIDIOC_STREAMON without VIDIOC_STREAMOFF in-between.

Signed-off-by: Helen Koike <helen.koike at collabora.com>
---
 src/cam/capture.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index e455612..6b842d7 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -117,6 +117,7 @@ int Capture::capture(EventLoop *loop)
 		ret = camera_->queueRequest(request);
 		if (ret < 0) {
 			std::cerr << "Can't queue request" << std::endl;
+			camera_->stop();
 			return ret;
 		}
 	}
-- 
2.20.1



More information about the libcamera-devel mailing list