The WebRTC video capture, encode & decode pipelines differ depending on whether it is in use for a native SDK or inside Chrome. This document outlines those differences for context, then describes the native UWP & .NET implementations developed by Microsoft.
Media handling in WebRTC when running in Chrome is handled by external (to WebRTC) components. You can find the references to Chromium media processing resources here: https://github.com/chromium/chromium/tree/master/content/renderer/media/webrtc https://github.com/chromium/chromium/tree/master/media/gpu/windows
- H.264 Decoder: Chrome uses
FFMPEG
to decode the stream which will use Direct3D H.264 hardware decoding if available. On Windows N SKUs without the Media Pack where no system H.264 codec is present, it will fall back toOpenH264
software decoding. - H.264 Encoder: Media Foundation Transform (MFT) uses hardware where available.
NV12
output is converted toI420
using libyuv (CPU). - Video Capturer: MF based - MFCreateDeviceSource() with DirectShow used for fallback. WRL is used to keep the references to COM objects which is part of WinRT API.
- Testing: DirectShow virtual cameras are added to the array of MF device as MF does not have a virtual camera.
Note: Other Chrome platforms are not considered here.
- H.264 Decoder:
FFMPEG
is used, similar to the Chrome implementation. - H.264 Encoder:
OpenH264
- SW codec - temporal and spatial SVC, simulcast - Video Capturer:
DirectShow
used to capture video.
- H.264 Decoder: The UWP & .NET native components utilize an MFT-backed (Media Foundation Transform) H.264 forward decoder implementation which is internal to WebRTC. This uses the same codepath as VPX decoders. NV12 output is converted to I420 using
libyuv
(CPU).- Unit Tests: H.264 decoder in the UWP stack has gtest coverage..
- See the TODO section at the top of H264Decoder.cc for a list of pending tasks which will be addressed in future PRs.
- H.264 Encoder: Implented as a custom
IMFMediaSink
. NV12 output is converted to I420 usinglibyuv
(CPU). Source here. - Video Capturer: Custom
IMFMediaSink
-NV12
output is converted toI420
using libyuv (CPU). This is implemented as a C++/WinRT external component.
Raw frame access is available for both H.264 and VPX codecs in the UWP & .NET stack. This is used for scenarios including remote video composition and ML.
- When running on Windows "N" editions which lack the H.264 codec, Chrome falls back to OpenH264. Compatibility between OpenH264 and the MF encoders/decoders should be tested to ensure Chrome hardware and software accelerated H264 implementations are compatible.