Re: [PATCH v1] media: vivid: Add webcam parameter for (un)limited bandwidth
From: Max Staudt
Date: Tue Apr 11 2023 - 02:52:59 EST
Thank you Mauro for having a first look!
Questions below.
On 4/10/23 18:23, Mauro Carvalho Chehab wrote:
IMO, instead of a parameter that just enables/disables the bandwidth
limit, the best would be to have a parameter specifying the bandwidth
(with 0 meaning unlimited).
If not used, vivid would initialize it to dev->webcam_bandwidth_limit,
so a read operation will show the current limit.
Up until now, the bandwidth limit is a rather arbitrary reduction of two
interval sizes per frame size.
How would you prefer to define a limited bandwidth in this parameter?
How would it affect the simulated camera, do you have a suggestion for a
formula from bandwidth to frame/interval sizes offered?
+/* Default: limited webcam bandwidth */
+static bool webcam_bandwidth_limit[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = true };
+module_param_array(webcam_bandwidth_limit, bool, NULL, 0444);
I would also use 0666, to allow changing this on runtime.
I guess that's possible, though it would add complexity.
Currently we can ask for two instances, each with a different setting:
n_devs=2 webcam_bandwidth_limit=1,0
This creates /dev/video0 which is limited, and /dev/video4 which is
unlimited.
Maybe this already sufficiently covers the case you are looking for, and
we can keep the complexity low? A real webcam won't suddenly offer new
frame rates either...
Max