mediasoup - The Serendipitous Choice
For Huddle01, selecting the right Selective Forwarding Unit (SFU) was a critical engineering decision. Read on to know why we chose mediasoup.
At Huddle01, we offer audio and video infrastructure, making SFUs a critical part of our operations.
An SFU, or Selective Forwarding Unit, is a video routing server specifically designed for multi-party video conferences. It receives multiple media streams from call participants, determines where each stream should be sent, and then forwards the appropriate streams to each participant. Unlike other video routing solutions, an SFU simply forwards the incoming streams without mixing them.
The SFU Landscape When We Started
Three years ago, when we embarked on our journey with Huddle01, the landscape of setting up your own Selective Forwarding Unit (SFU) fleet was akin to navigating an uncharted territory. There were scarcely any guides or extensive information available in the open. We were faced with a few choices: Jitsi Server, Kurento, and mediasoup.
Back then, we were a dynamic group of young developers, eager to make our mark. Our choice to go with mediasoup wasn't a random decision. We were strongly swayed by its high commit activity, which hinted at the active development and support behind the scenes. Equally impressive was the comprehensive and well-crafted documentation mediasoup had at the time, which stood head and shoulders above the rest.
Our experience in JavaScript was another factor that tilted the scales in favor of mediasoup. It offered a JavaScript API over the SFU, aligning perfectly with our skills and expertise. It was like finding a key that perfectly fits the lock, making mediasoup the ideal choice for us.
Technical Deep-Dive into mediasoup
Adopting a minimalist approach, mediasoup focuses exclusively on the media layer, avoiding the addition of unnecessary functionalities beyond its core competence. It doesn't impose any specific signaling protocol. Signaling, which is essential for coordinating communication, is entirely delegated to the application layer. This level of agnosticism paves the way for integrating with pre-existing signaling solutions, granting developers the flexibility to select or create signaling workflows that are most suitable for their applications. This provides developers with complete freedom to manage other aspects, ranging from UI to state management from the frontend, and to structure their SFU backend to cater to their specific use case.
💡 An interesting side note: mediasoup served as a major inspiration for our own SDK. It taught us to concentrate on and excel in our area of expertise.
Moreover, mediasoup provides client-side packages that function as a shim—a slim middleware that offers a uniform interface—for client devices to connect to the media node. This enables the execution of all WebRTC API control functionalities using simple functions.
Our Experience and Results
Over the past three years, mediasoup has undergone significant evolution and transformation. This change has not only been reflected in the software itself, but also in our infrastructure. We have successfully transitioned from a monolithic environment to a more flexible and responsive global region-aware infrastructure.
This massive shift has enabled us to better serve our users, regardless of their location. It has also allowed us to more effectively manage and distribute our resources, ensuring optimal performance at all times.
One of the key factors that has made this transition possible is the low-level control interface provided by mediasoup. This feature has given us an unprecedented level of control and flexibility, which has been instrumental in our ability to adapt and grow.
Moreover, the active development and community support that mediasoup offers have been invaluable. The constant updates and improvements, coupled with the assistance and feedback from the community, have allowed us to continually enhance our services. This is why we continue to use mediasoup for our production SFUs to this very day.
Conclusion
From the perspective of a real-time infrastructure provider, selecting the right Selective Forwarding Unit (SFU) is a critical engineering decision that can significantly influence your product. Understanding the exact use case for the SFU and knowing the amount of engineering effort available to work on it are crucial to this decision.
Using mediasoup is beneficial for us because it is low-level, allowing us to make optimizations at the most fundamental level. For new companies or hobbyists starting out, fully ready out-of-the-box SFUs like Jitsi are available. Jitsi even comes with a ready-made client frontend and SFU server, making it a good starting point.
Personal Note
Looking back, it's fair to say that luck played a part in our decision to adopt mediasoup. It wasn't a choice based on extensive research or analysis, but rather a fortunate discovery we stumbled upon while trying to figure out SFU technologies.
Luck often plays a behind-the-scenes role in business and tech advancements. Too often, we focus on measurable factors like features, performance, and cost, overlooking the part luck plays. In our case, it was pure chance that we found mediasoup, and it's proven to be a pivotal factor in our success.
While we did get lucky, the successes we've achieved with mediasoup are equally due to our dedicated team and the supportive mediasoup community. Our team's resilience in learning and mastering mediasoup's intricacies has been truly impressive. Their readiness to dig into a low-level API and customize it to our specific needs has been fundamental to our robust RTC infrastructure.
We also owe a lot to the mediasoup community. Open-source projects succeed through collaboration and knowledge sharing, and the community around mediasoup perfectly exemplifies this spirit. From troubleshooting to brainstorming to reading funny threads on mediasoup’s discourse.
Special thanks to Iñaki Baz Castillo , José Luis Millán , Nazar Mokrynskyi , Gustavo Garcia for creating and actively maintaining mediasoup.
In the end, it was a mix of good fortune, decision-making, and teamwork that turned what could have been a brief encounter with technology into a key component of our services. It's a testament to the power of human creativity, collaboration, and a bit of luck that reminds us that the best tech stories, like life, are often the ones you couldn't make up.