camera-monitors: add a config property for camera discovery timeout

This commit is contained in:
Ashok Sidipotu
2023-07-21 17:19:09 +05:30
committed by George Kiagiadakis
parent 2d4cdcd5da
commit 591d0b4370
3 changed files with 7 additions and 1 deletions

View File

@@ -23,4 +23,7 @@ wireplumber.settings = {
## Sets the default echo-cancel-source node name to automatically switch to
# device.echo-cancel-source-name = "echo-cancel-source"
## The device discovery time out(in milli sec) between V4L2 and libcamera.
# device.camera-discovery-timeout = 100
}

View File

@@ -15,6 +15,7 @@ local defaults = {
["auto-echo-cancel"] = true,
["echo-cancel-sink-name"] = "echo-cancel-sink",
["echo-cancel-source-name"] = "echo-cancel-source",
["camera-discovery-timeout"] = 100,
}
return settings_manager.new ("device.", defaults)

View File

@@ -7,7 +7,9 @@
-- Script is a Lua Module of monitor Lua utility functions
config = require ("device-config")
log = Log.open_topic ("s-monitors-utils")
d_timeout = config["camera-discovery-timeout"]
local mutils = {
cam_data = {}
@@ -102,7 +104,7 @@ function mutils.register_cam_node (self, parent, id, factory, properties)
local other_api = api == "v4l2" and "libcamera" or "v4l2"
if cam_api_data.enum_status and not cam_data[other_api].enum_status then
log:trace (string.format ("\"%s\" armed a timer for %d", api, dev_num))
cam_data.source = Core.timeout_add (100, function()
cam_data.source = Core.timeout_add (d_timeout, function()
log:trace (string.format ("\"%s\" armed timer expired for %d", api, dev_num))
self:create_cam_node (dev_num)
cam_data.source = nil