[v6,2/7] The Fatal check of having at least one MediaDevice was to prevent pipeline handler implementations searching and owning media devices with custom conventions, instead of using the base function |acquireMediaDevice|. It also has the assumption tha
diff mbox series

Message ID 20240726095626.3632402-3-chenghaoyang@chromium.org
State Superseded
Headers show
Series
  • Add VirtualPipelineHandler
Related show

Commit Message

Harvey Yang July 26, 2024, 9:54 a.m. UTC
From: Harvey Yang <chenghaoyang@google.com>

Now that the assumption will be broken by the virtual pipeline handler
added in the following patches, and developers should be aware of the
available functions in the base class to handle media devices, the Fatal
check is no longer needed.

Change-Id: I76b4b74ebb2fa982136a9f9ab1c8a0a98b518c3a
Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
---
 src/libcamera/pipeline_handler.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 5ea2ca780..125cf9d5e 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -605,9 +605,14 @@  void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)
 {
 	cameras_.push_back(camera);
 
-	if (mediaDevices_.empty())
-		LOG(Pipeline, Fatal)
-			<< "Registering camera with no media devices!";
+	if (mediaDevices_.empty()) {
+		/*
+		 * For virtual devices with no MediaDevice, there are no system
+		 * devices to register.
+		 */
+		manager_->_d()->addCamera(std::move(camera));
+		return;
+	}
 
 	/*
 	 * Walk the entity list and map the devnums of all capture video nodes