flip79
Posts: 9
Joined: Sun Dec 16, 2012 12:19 am

Low resolution on Chromium - WebRTC

Thu Sep 15, 2016 10:39 pm

I'm developing a 1-to-1 videochat project with RPI 3 + Raspcam, using WebRTC and Chromium (on the Rasp side; the other user will use a mobile phone or an another random computer).

After loading the correct module:
sudo modprobe bcm2835-v4l2
I succeded using the camera board like a regular webcam with my WebRTC script, both with Chromium and Firefox/Iceweasel. The only difference is that resolution is great in Firefox and absolutely low (like a magnified thumbnail... I'm talking about something REALLY tiny and blurred) in Chromium.

Any suggestion? :)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12848
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Low resolution on Chromium - WebRTC

Fri Sep 16, 2016 9:38 am

It's a Chromium bug.
https://bugs.chromium.org/p/chromium/is ... ?id=616007
https://bugs.chromium.org/p/chromium/is ... ?id=249953
https://github.com/raspberrypi/linux/issues/1498

Chromium doesn't support devices that advertise their resolutions as being V4L2_FRMSIZE_TYPE_STEPWISE (as Pi does) or V4L2_FRMSIZE_TYPE_CONTINUOUS, only V4L2_FRMSIZE_TYPE_DISCRETE.
That means Chromium ends up asking V4L2 for a 0x0 frame. The V4L2 API requires the driver to select the nearest supported mode, so we end up at 32x32, and things look rather blurry.

The correct solution is to support things properly in Chromium, but they seem to be ignoring the issue.

Amending the V4L2 driver to have a kernel parameter to say it should support a limited list of discrete resolutions would be possible, but is a nasty hack, and reduces the capability set of the driver massively. If someone did it cleanly and submitted a PR to the kernel tree then I would accept it. We do already have a nasty hack parameter in there due to a failure in older versions of GStreamer. Actually that is on the same ioctl.
Comments at https://github.com/raspberrypi/linux/bl ... mera.c#L69
/* Gstreamer bug https://bugzilla.gnome.org/show_bug.cgi?id=726521
* v4l2src does bad (and actually wrong) things when the vidioc_enum_framesizes
* function says type V4L2_FRMSIZE_TYPE_STEPWISE, which we do by default.
* It's happier if we just don't say anything at all, when it then
* sets up a load of defaults that it thinks might work.
* If gst_v4l2src_is_broken is non-zero, then we remove the function from
* our function table list (actually switch to an alternate set, but same
* result).
*/

I just wonder what Chromium would do in that case. You can try it with "sudo modprobe bcm2835-v4l2 gst_v4l2src_is_broken=1" when loading the driver.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

flip79
Posts: 9
Joined: Sun Dec 16, 2012 12:19 am

Re: Low resolution on Chromium - WebRTC

Sat Sep 17, 2016 5:19 pm

With "sudo modprobe bcm2835-v4l2 gst_v4l2src_is_broken=1" everything seems to work in Chromium. Thank you SO MUCH for your precious help and for the complete explanation of this bug!!!

Return to “Camera board”