WebRTC support in WebKitGTK and WPEWebKit with GStreamer: Status update

igalia 36 views 31 slides Mar 11, 2025
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

The WebKit WPE and GTK ports are aiming to leverage GstWebRTC as their WebRTC
backend. Over the years we made progress towards this goal both in WebKit and
in GStreamer. During this talk we will present the current integration status
of GstWebRTC in WebKit and the plans we have for the coming months...


Slide Content

WebRTC support in WebKitGTK andWebRTC support in WebKitGTK and
WPEWebKit with GStreamerWPEWebKit with GStreamer
Philippe NormandPhilippe Normand
FOSDEM 2025FOSDEM 2025
11//3030

OutlineOutline
IntroIntro
Current statusCurrent status
Practical use-casesPractical use-cases
On-going work & plansOn-going work & plans
22//3030

About meAbout me
Multimedia engineer at Igalia since ~2009Multimedia engineer at Igalia since ~2009
Working on GStreamer and WebKit Linux portsWorking on GStreamer and WebKit Linux ports
Was involved in the OpenWebRTC project and its integration in WebKitGTKWas involved in the OpenWebRTC project and its integration in WebKitGTK
33//3030

Intro - WebKitIntro - WebKit
FOSS Web engine, maintained by Apple, Igalia, SonyFOSS Web engine, maintained by Apple, Igalia, Sony
WebView API, generally allowing native apps to render the webWebView API, generally allowing native apps to render the web
Web browsersWeb browsers
Set-top-box UIsSet-top-box UIs
News readersNews readers
Platform-specific (upstream) ports:Platform-specific (upstream) ports:
Apple productsApple products
Sony PlaystationSony Playstation
Linux Desktop (GTK port)Linux Desktop (GTK port)
Linux Embedded (WPE port)Linux Embedded (WPE port)
Windows & JSCOnlyWindows & JSCOnly
44//3030

Intro - Why not use LibWebRTC? (1/2)Intro - Why not use LibWebRTC? (1/2)
55//3030

Intro - Why not use LibWebRTC? (2/2)Intro - Why not use LibWebRTC? (2/2)
WPE and WebKitGTK support LibWebRTC but:WPE and WebKitGTK support LibWebRTC but:
BoringSSL license preventing use in GPL appsBoringSSL license preventing use in GPL apps
Footprint in tarballsFootprint in tarballs
Integration with GStreamer video decoders very fragileIntegration with GStreamer video decoders very fragile
Lack of hardware-accelerated video encodingLack of hardware-accelerated video encoding
Why do we need another Multimedia framework anyway?Why do we need another Multimedia framework anyway?
Let’s now talk about GStreamer and GstWebRTC ;)Let’s now talk about GStreamer and GstWebRTC ;)
66//3030

Intro - GStreamer (1/2)Intro - GStreamer (1/2)
Cross-platform open-source multimedia frameworkCross-platform open-source multimedia framework
Widely deployed on embedded platforms (even in the ISS space station!)Widely deployed on embedded platforms (even in the ISS space station!)
Custom plugins available, depending on target Set-top-box platformsCustom plugins available, depending on target Set-top-box platforms
Checkout the Checkout the GStreamer: State of the Union 2025GStreamer: State of the Union 2025 talk tomorrow in the Open Media talk tomorrow in the Open Media
devroom (K.3.401) at 3pm!devroom (K.3.401) at 3pm!
77//3030

Intro - GStreamer (2/2)Intro - GStreamer (2/2)
88//3030

Intro - GstWebRTCIntro - GstWebRTC
one GStreamer element (one GStreamer element (webrtcbinwebrtcbin) for integration in pipelines) for integration in pipelines
Can be thought of as a PeerConnection objectCan be thought of as a PeerConnection object
Signals and properties to perform Offer/AnswerSignals and properties to perform Offer/Answer
one GStreamer library shipping public API (one GStreamer library shipping public API (libgstwebrtc.solibgstwebrtc.so))
Defines classes for WebRTC-related objects (Transceivers, …)Defines classes for WebRTC-related objects (Transceivers, …)
Pluggable ICE and Transport backend support (only libnice currently)Pluggable ICE and Transport backend support (only libnice currently)
99//3030

Current statusCurrent status
1010//3030

WebRTC in WebKit, using GStreamerWebRTC in WebKit, using GStreamer
Dedicated pipeline for audio/video captureDedicated pipeline for audio/video capture
Another pipeline for encoding and streaming over the networkAnother pipeline for encoding and streaming over the network
Seamless integration with hardware-accelerated encodersSeamless integration with hardware-accelerated encoders
Zero-copy encoding from webcam to RTP payloader possibleZero-copy encoding from webcam to RTP payloader possible
Incoming streams routed to separate pipelines for playbackIncoming streams routed to separate pipelines for playback
Seamless integration with hardware-accelerated decodersSeamless integration with hardware-accelerated decoders
1111//3030

Stream captureStream capture
One pipeline per capture device (Camera, Microphone, Desktop)One pipeline per capture device (Camera, Microphone, Desktop)
Permission request handlingPermission request handling
For For getDisplayMedia()getDisplayMedia()::
Desktop portal (PipeWire) mandatoryDesktop portal (PipeWire) mandatory
Capture pipeline connects to PipeWire, gets frames as DMABufsCapture pipeline connects to PipeWire, gets frames as DMABufs
1212//3030

MediaStreamMediaStream handling handling
webkitmediastreamsrcwebkitmediastreamsrc GStreamer source element acting as Observer for: GStreamer source element acting as Observer for:
Capturer pipelinesCapturer pipelines
Canvas / Canvas / <video><video> elements elements
Incoming WebRTC Incoming WebRTC MediaStreamMediaStreamss
Each Each MediaStreamTrackMediaStreamTrack maps to a maps to a GstPadGstPad in in webrtcbinwebrtcbin
1313//3030

PeerConnectionPeerConnection handling (1/2) handling (1/2)
RealtimeIncomingSourceRealtimeIncomingSource
webrtcbinwebrtcbin
RealtimeOutgoingVideoSourceRealtimeOutgoingVideoSource
RealtimeOutgoingAudioSourceRealtimeOutgoingAudioSource
mediastreamsrcmediastreamsrc parsebinparsebin appsinkappsink
Video EncoderVideo Encoder Video RTP PayloaderVideo RTP Payloader
Audio EncoderAudio Encoder Audio RTP PayloaderAudio RTP Payloader
payloadedpayloaded encodedencodedsinksink sinksinksinksink srcsrcsinksink
sinksink
srcsrc
srcsrcsinksink srcsrcsinksink srcsrc
srcsrcsinksink srcsrcsinksink srcsrcaudioaudio
videovideo
1414//3030

PeerConnectionPeerConnection handling (2/2) handling (2/2)
webrtcbinwebrtcbin implements the JavaScript Session Establishment Protocol (JSEP) implements the JavaScript Session Establishment Protocol (JSEP)
Almost seamless integration with WebKit’s PeerConnection infrastructureAlmost seamless integration with WebKit’s PeerConnection infrastructure
GstPromiseGstPromise integration with WebKit’s integration with WebKit’s Promise<T>Promise<T>
1515//3030

Incoming Incoming MediaStreamMediaStream playback playback
In JS: In JS: videoElt.src = mediaStreamvideoElt.src = mediaStream
=> In => In WebCore::MediaPlayerPrivateGStreamerWebCore::MediaPlayerPrivateGStreamer: : playbin3playbin3
uri=mediastream://uuiduri=mediastream://uuid
==> Internally hooks the ==> Internally hooks the MediaStreamMediaStream to to webkitmediastreamsrcwebkitmediastreamsrc
1616//3030

Additional WebRTC-related APIs (1/2)Additional WebRTC-related APIs (1/2)
StatisticsStatistics
Queried to Queried to webrtcbinwebrtcbin using a GObject action signal using a GObject action signal
Some informations can’t be filled by Some informations can’t be filled by webrtcbinwebrtcbin
frames-decodedframes-decoded, , frames-encodedframes-encoded, , bitratebitrate, … filled in by WebKit, … filled in by WebKit
DataChannel, DataChannel, RTCDataChannelRTCDataChannel maps fairly well with maps fairly well with GstWebRTCDataChannelGstWebRTCDataChannel
1717//3030

Additional WebRTC-related APIs (2/2)Additional WebRTC-related APIs (2/2)
replaceTrack()replaceTrack()
pc.createOffer({offerToReceiveAudio: true, offerToReceiveVideo:pc.createOffer({offerToReceiveAudio: true, offerToReceiveVideo:
true})true})
1818//3030

Practical use-casesPractical use-cases
1919//3030

The obvious ones: Video callsThe obvious ones: Video calls
Jitsi: Very early stage bring-upJitsi: Very early stage bring-up
Livekit: We can connect and receive A/V. Sending not working yetLivekit: We can connect and receive A/V. Sending not working yet
2020//3030

Amazon LunaAmazon Luna
Game streaming, gamepad events sent using DataChannelGame streaming, gamepad events sent using DataChannel
Optional support for live WebCam/Mic overlay to Twitch (WIP)Optional support for live WebCam/Mic overlay to Twitch (WIP)
DemoDemo
2121//3030

Zoo, Industrial modeling applicationZoo, Industrial modeling application
CAD model rendered server-side with WebRTCCAD model rendered server-side with WebRTC
DataChannel for sending pointer eventsDataChannel for sending pointer events
DemoDemo
2222//3030

On-going workOn-going work
2323//3030

WebRTC Devtools in WebKit (1/3)WebRTC Devtools in WebKit (1/3)
Currently a well-hidden WebInspector feature: Currently a well-hidden WebInspector feature: gatherWebRTCLogs(func)gatherWebRTCLogs(func)
2424//3030

WebRTC Devtools in WebKit (2/3)WebRTC Devtools in WebKit (2/3)
End goal: Events and stats gathering for live graphing and post-mortem analysisEnd goal: Events and stats gathering for live graphing and post-mortem analysis
Support for LibWebRTC and GstWebRTC WebKit buildsSupport for LibWebRTC and GstWebRTC WebKit builds
JSON stream emitted by WebKit’s PeerConnection backends, including timestampedJSON stream emitted by WebKit’s PeerConnection backends, including timestamped
events, example:events, example:
{"peer-connection":"7F1C6E013520","timestamp":1725960727633365.8,"type":"event","event":{"message":"PeerConnection creat{"peer-connection":"7F1C6E013520","timestamp":1725960727633365.8,"type":"event","event":{"message":"PeerConnection creat
{"peer-connection":"7F1C6E013680","timestamp":1725960735855362.8,"type":"stats","event":{"type":"inbound-rtp","id":"rtp-{"peer-connection":"7F1C6E013680","timestamp":1725960735855362.8,"type":"stats","event":{"type":"inbound-rtp","id":"rtp-
Backend enabled using an env variable: Backend enabled using an env variable: WEBKIT_WEBRTC_JSON_EVENTS_FILEWEBKIT_WEBRTC_JSON_EVENTS_FILE
Basic web frontend able to read such JSON file and render graphsBasic web frontend able to read such JSON file and render graphs
2525//3030

WebRTC Devtools in WebKit (3/3)WebRTC Devtools in WebKit (3/3)
Graphs showing basic stats about inbound and outbound RTP streamsGraphs showing basic stats about inbound and outbound RTP streams
2626//3030

More featuresMore features
Basic support for network conditions simulation (packet loss, …) ✅Basic support for network conditions simulation (packet loss, …) ✅
Simulcast: ✅-ishSimulcast: ✅-ish
SVC (VP8 ✅, VP9/AV1 ??????)SVC (VP8 ✅, VP9/AV1 ??????)
Hardware-accelerated encoding ?????? (promising results on RPi/OMX andHardware-accelerated encoding ?????? (promising results on RPi/OMX and
desktop/VAAPI)desktop/VAAPI)
E2EE with SFrame ?????? (pending implementation details and potential interop issues)E2EE with SFrame ?????? (pending implementation details and potential interop issues)
2727//3030

Access to capture devices fromAccess to capture devices from
sandboxed WebKitsandboxed WebKit
The current capture device pipeline runs in WebProcess (BAD!)The current capture device pipeline runs in WebProcess (BAD!)
Ideally the WebProcess should be sandboxed, hence no direct access to captureIdeally the WebProcess should be sandboxed, hence no direct access to capture
devicesdevices
Currently we allow-list v4l devices in the sandboxCurrently we allow-list v4l devices in the sandbox
Plan (2025): Integration with the desktop Camera portal, giving us access toPlan (2025): Integration with the desktop Camera portal, giving us access to
PipeWire nodesPipeWire nodes
WPE on Embedded platforms will still need v4l devices allow-listingWPE on Embedded platforms will still need v4l devices allow-listing
2828//3030

UDP streaming from sandboxed WebKitUDP streaming from sandboxed WebKit
The current streaming pipeline runs in WebProcess (BAD!)The current streaming pipeline runs in WebProcess (BAD!)
Ideally the network usage should be restricted to the NetworkProcessIdeally the network usage should be restricted to the NetworkProcess
libgstwebrtclibgstwebrtc now supports custom ICE implementations now supports custom ICE implementations
libricelibrice provides a Sans-IO implementation for ICE handling provides a Sans-IO implementation for ICE handling
Plan (2025): Implement a librice-based ICE backend in the WebProcess, handlingPlan (2025): Implement a librice-based ICE backend in the WebProcess, handling
IPC I/O with NetworkProcessIPC I/O with NetworkProcess
2929//3030

Thanks!Thanks!
Any question?Any question?
3030//3030