As Dale pointed out, even if mjpeg is used by the camera, the pipeline itself can't handle MJPEG, it's always converted to YUV early in the capture pipeline.
There are a lot of places which would break otherwise. Another one is
VideoCaptureImpl. But to find them all some PoC will be needed.
I also think MJPEG media::VideoFrames wouldn't be renderable, you wouldn't be able to pass them to webrtc, media recorder, etc. There are half a dozen consumers which you will also have to fix.
Also, the pixel format isn't exposed anywhere to the JS/HTML, there's just no API to control it. So there will be a very huge hassle to add it to GetUserMedia constraints, where the resolution is already exposed. It will involve bureaucracy: standardization talks. After that, the capturers already can expose pixel format, they only expose just one usually (NV12 or I420 based on gpu memory buffers being allowed or not).
Then you'll have to change each individual capturer in media/capture/video, add a new capability, which is the same resolution but MJPEG.
Windows capturer for example forces to expose everything as NV12/I420
here.
Overall, this is quite a huge project.
If you are OK with the frames being decoded to NV12 in chrome and exposed like that to JS, but using Mjpeg on the camera, it's doable.
Again, you'll have to update each platform-specific capturer individually. Usually a capturer gets a list of possible formats from the camera, then chooses the "best" one. On windows it's done
here.
However, we generally prefer to avoid mjpeg, because decoding it is expensive. If the camera can provide an uncompressed format for the resolution we prefer it.
Also, note, on Windows and MacOS the system usually exposes "fake" nv12, which is actually mjpeg, decoded by the system. We try to avoid this one too.
We will oppose changing this default in chrome for performance reasons. If some specific camera doesn't work nicely unless mjpeg is selected, it would be fine to make a fix for that camera specifically, but not changing the default preference.