A smaller, faster video calling library for our apps

We are rolling out a new video calling library to all the relevant products across our apps and services, including Instagram, Messenger, Portal, Workplace chat, etc.  To create a library generic e…

Ishan Khot
8 min readadvanced
--
View Original

Overview

The article discusses the development of a new video calling library named rsys, designed to be smaller and faster for various applications like Messenger and Instagram. It highlights the architectural changes made to optimize performance and scalability, leveraging the latest advancements in video calling technology.

What You'll Learn

1

How to optimize a video calling library for multiple platforms

2

Why a unified architecture improves code maintainability and scalability

3

How to implement a state machine architecture for signaling in video calls

Prerequisites & Requirements

  • Familiarity with video calling technologies and architectures
  • Understanding of WebRTC and its APIs(optional)

Key Questions Answered

What improvements does the rsys library offer over the previous video calling library?
The rsys library is approximately 20 percent smaller than its predecessor, making it easier to integrate into size-constrained platforms. It supports multiple operating systems including Android, iOS, MacOS, Windows, and Linux, and features a unified architecture that simplifies code maintenance and enhances scalability.
How does the new architecture of rsys enhance video calling experiences?
The new architecture employs a state machine for signaling and media management, allowing for a unified protocol for both peer-to-peer and group calling. This reduces code duplication and enables easier updates to the underlying WebRTC version, ensuring a more reliable and efficient calling experience.
What are the key architectural changes made in rsys?
Key changes include the introduction of a state machine architecture for signaling, a reusable media stack that captures open source WebRTC semantics, and a Flux-based SDK for managing feature-specific states. These changes aim to minimize code complexity and optimize performance across platforms.

Key Statistics & Figures

Unit test coverage
90 percent
This high coverage ensures that most functionalities of the rsys library are tested, contributing to its reliability.
Core binary size reduction
20 percent
The core binary size was reduced from approximately 9 MB to around 7 MB, enhancing performance and integration.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Backend
Webrtc
Used as the foundation for the new video calling library, enabling real-time communication capabilities.
Frontend
Flux
Employed in the SDK to manage data and provide an API for calling products.
Backend
Boost.sml
Utilized for its optimally sized libraries to help achieve size gains throughout the applications.

Key Actionable Insights

1
To improve the performance of video calling applications, consider adopting a state machine architecture for managing signaling and media. This approach can streamline your codebase and reduce redundancy.
Implementing a state machine can help unify the handling of different calling protocols, making it easier to maintain and scale your application as new features are added.
2
Focus on optimizing the binary size of your libraries by modularizing features and using selective compilation techniques.
This can lead to faster loading times and better performance, especially for applications targeting low-powered devices or constrained environments.

Common Pitfalls

1
One common pitfall in developing video calling libraries is maintaining separate codebases for different applications, which can lead to duplicated efforts and inconsistencies.
This often results in increased maintenance overhead and slower feature development. A unified architecture can help mitigate this issue by allowing shared code and reducing redundancy.