rtcp-mux stands for RTCP multiplexing.
It is a process whereas RTP and RTCP share the same socket and connection, instead of using two separate connections.
This allows reducing the number of opened sockets and pinholes that need to be managed and reduces the resources required to get a session work through a firewall or NAT device.
While rtcp-mux is common in WebRTC, it is in less common use by other VoIP services and protocols that make use of RTP and RTCP.
See also BUNDLE.
Understanding the basics
In a simplistic, “old fashioned”, video call scenario, multiple ports are necessitated to facilitate the sending and receiving of media. To break it down, a total of four distinct connections are established – two for audio (RTP and RTCP) and two for video (RTP and RTCP). Here’s how it works:
- RTP: This is the channel over which audio and video data are transmitted
- RTCP: Acting as a control channel, RTCP is used alongside RTP to provide feedback on the quality of service being provided
Each media type (audio and video) requires separate RTP and RTCP connections, which are then synchronized using SSRC (Synchronization Source) identifiers and timestamps. The SSRC indicates the originating source of the media, while the timestamps denote when the data is sent from the local device.
The challenge at hand
The requirement of four separate ports for a single video call presents several challenges:
- Resource Consumption: More connections equate to higher resource utilization, especially on the server-side when dealing with hundreds or thousands of simultaneous connections
- Setup Time: The setup time increases as each port necessitates its own separate connection setup (full trickle ICE procedure), slowing down the overall process
- Success Rate: With more connections, the likelihood of a successful setup decreases. If any one of the connections fails, the entire call fails
Transitioning to WebRTC
Before the advent of WebRTC, the default setup involved four connections as described above. However, WebRTC introduced two key mechanisms to optimize this setup:
- Bundling: This mechanism allows bundling of audio and video over a single RTP connection, with RTCP also being bundled together for both media types. This is signaled over SDP by stating
group: BUNDLE
- RTCP-MUX: Taking it a step further, RTCP-MUX enables the multiplexing of RTCP over RTP. This means using the same connection and port for both RTP and RTCP data of audio and video.
By employing both bundling and RTCP-MUX, it’s possible to have a single connection where all RTP and RTCP data for audio and video are multiplexed, significantly optimizing server resources and setup time.
Embracing RTCP-MUX
RTCP-MUX is not just a theoretical concept but a practical solution to enhance the efficiency of WebRTC connections. By reducing the number of ports and connections required for a video call, RTCP-MUX plays a pivotal role in speeding up the setup time, improving the success rate, and optimizing server resources.