<linearGradient id="sl-pl-stream-svg-grad01" linear-gradient(90deg, #ff8c59, #ffb37f 24%, #a3bf5f 49%, #7ca63a 75%, #527f32)
WebRTC for Embedded: Compiling LibWebRTC for ARM

WebRTC for Embedded: Compiling LibWebRTC for ARM

Introduction

WebRTC has become a cornerstone for real-time communication in web applications, enabling seamless audio, video, and data streaming directly in the browser. However, when it comes to IoT and embedded devices, leveraging WebRTC in a browser may not be the most efficient option. This is where compiling LibWebRTC natively for ARM devices comes into play. By doing so, developers can create highly optimized applications that significantly reduce CPU usage, resulting in lower power consumption and improved performance—key factors for IoT and embedded systems.

When you compile LibWebRTC for ARM, especially in the context of IoT and embedded devices, you unlock the potential to run real-time communication applications natively on ARM processors. This approach offers several advantages over using WebRTC within a browser, such as reduced latency, better resource management, and enhanced performance. The result is a more stable and reliable communication experience, which is crucial for applications in resource-constrained environments like smart homes, industrial IoT, and other embedded systems.

WebRTC for Embedded: Steps to Compile LibWebRTC for ARM

Compiling LibWebRTC for ARM, particularly for IoT and embedded devices, requires a few detailed steps. The following guide will help you through the process:

1. Set Up the Build Environment

Start by preparing an Ubuntu environment, either directly on an ARM device or on an x86 machine if you plan to cross-compile for ARM. Ensure that all necessary dependencies, such as Python, Git, and the build-essential package, are installed.

sudo apt-get update
sudo apt-get install build-essential python git
2. Fetch the LibWebRTC Source Code

Clone the depot tools repository, which is essential for managing the source code of LibWebRTC.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/path_to_depot_tools"

Fetch the LibWebRTC source code using the following commands:

fetch --nohooks webrtc
cd src
gclient sync
3. Explore Available GN Build Options

Before generating the GN build files, it’s beneficial to review all available build options. This step ensures that you configure your build optimally for your IoT or embedded ARM device.

gn args out/Default --list

This command lists all configurable GN build options, allowing you to tailor the build process to your specific needs.

4. Set Up GN Configuration

Generate GN build files tailored to the target architecture, either ARM32 or ARM64.

For ARM32:

gn gen out/arm32 --args='target_os="linux" target_cpu="arm" is_debug=false is_clang=true use_custom_libcxx=false'

For ARM64:

gn gen out/arm64 --args='target_os="linux" target_cpu="arm64" is_debug=false is_clang=true use_custom_libcxx=false'

Selecting the correct target_cpu (either arm for ARM32 or arm64 for ARM64) is crucial for optimizing the build for your IoT or embedded device.

5. Compile the Code

Once the GN configuration is set, you can proceed to compile the code using Ninja.

For ARM32:

ninja -C out/arm32

For ARM64:

ninja -C out/arm64

The compilation process may take some time, depending on your system’s hardware capabilities.

6. Deploy and Test

After successfully compiling LibWebRTC for ARM, deploy the binaries to your target IoT or embedded device. Comprehensive testing is essential to ensure that all functionalities are working correctly and that the performance benefits specific to your device are realized.

Note:

While compiling for ARM devices, one should use this option is_clang=truewhich is required to compile the neon flags available in the ARM architecture for video rendering acceleration. The default GCC in the Ubuntu-based Linux systems is not capable of compiling these flags and complains about neon flags. Therefore, it is advisable to use the clang already provided by the LibWebRTC to compile it rather than using the system’s default C++ compiler which is GCC.

Summary

Compiling LibWebRTC for ARM devices, particularly in the context of IoT and embedded systems, offers significant advantages over using browser-based WebRTC. Native compilation allows you to fine-tune applications to run efficiently on ARM processors, resulting in lower CPU usage, reduced power consumption, and enhanced performance. This is especially important for IoT and embedded devices where resources are limited, and efficiency is paramount.

For businesses operating in the IoT and embedded systems domain, optimizing WebRTC for ARM devices by compiling LibWebRTC natively opens up a world of possibilities. It enables the delivery of high-quality video calls, low-latency data streaming, and efficient resource usage—all critical factors for success in this field. Whether you’re developing applications for remote healthcare, smart home devices, or industrial automation, the ability to provide reliable, real-time communication on low-powered ARM CPUs is a game-changer that can drive innovation and efficiency in your solutions.

We recently built a C++ video application for ARM devices (both 32-bit and 64-bit) to work with our existing cloud video infrastructure. From our recent experience, we can say that it’s not an easy task and needs significant effort to compile & build a native C++ video application. If you also have an IOT / Embedded video conferencing/streaming use case and don’t know where to start, do shout at hello@centedge.io. You also can schedule a video call with us to discuss your use case using our Meetnow page.

This technical article was first published here.

Redefining Elevator Safety with WebRTC

Redefining Elevator Safety with WebRTC

Introduction

As urbanization drives the construction of high-rise buildings, elevators have become an essential component of modern infrastructure. With millions relying on these systems daily, ensuring passenger safety has never been more critical. This white paper explores the evolution of safety elevators, current market dynamics, and how WebRTC technology can redefine safety standards by enabling real-time two-way video communication.

A Brief History of Safety Elevators

The invention of the safety elevator revolutionized urban architecture, enabling skyscrapers and high-rise buildings. Elisha Otis introduced the first safety elevator in 1852, a system that incorporated a fail-safe brake mechanism to prevent the elevator from plummeting in case of rope failure. Since then, elevators have become indispensable, evolving from simple manual controls to advanced automated systems equipped with state-of-the-art safety features.

The Growing Importance of Safety Elevators

With the rapid urbanization of cities worldwide, safety elevators have seen exponential growth. According to market reports, the global elevator market is expected to reach $135 billion by 2030, driven by increased high-rise construction and stricter safety regulations. As cities grow vertically, ensuring the safety of elevator passengers during emergencies has become a paramount concern for manufacturers and regulators alike.

Rethinking Elevator Safety: The Role of Two-Way Video Calling Systems

While traditional safety systems like alarms and emergency stop buttons have been effective, they often fall short in addressing real-time emergencies, such as medical crises or mechanical failures. Two-way video calling systems offer a transformative solution, enabling real-time communication between passengers and emergency response teams. This technology can bridge critical gaps in emergency response, providing instant visual and auditory information that aids faster and more effective rescue planning.

Current Emergency Response Technologies in Elevators

Most modern elevators are equipped with:

  • Emergency intercoms for audio communication.
  • Alarm buttons to alert building security.
  • Automatic emergency braking systems for mechanical safety.

However, these legacy systems often lack the real-time visual context required for effective decision-making during complex emergencies.

WebRTC: Enhancing Safety with Real-Time Video Communication

WebRTC (Web Real-Time Communication) introduces a paradigm shift by enabling high-quality, low-latency video and audio communication directly between elevator occupants and rescue teams. Its benefits include:

  • Improved situational awareness through live video feeds.
  • Faster response times as rescue teams receive real-time updates.
  • Enhanced passenger confidence during emergencies.

Unlike traditional systems, WebRTC-based solutions operate efficiently without relying on centralized servers, ensuring robust performance even in challenging network conditions.

Challenges in Hardware Integration

Integrating a WebRTC-based video calling system into elevator hardware poses unique challenges:

  1. Limited CPU Power: Elevator control units typically run minimalistic Linux-based operating systems with low processing capabilities.
  2. Absence of Browsers: Many systems lack browser environments necessary for running WebRTC applications.
  3. Hardware Constraints: Limited support for video and audio processing, leading to potential performance bottlenecks.

Building a Native WebRTC Solution for hardware integrations

To overcome these challenges, Videoedge developed a highly optimized solution:

  1. Native libWebRTC Build: Custom-compiled WebRTC libraries for target hardware.
  2. C++ Application: Designed to leverage RTC peer connection objects for establishing calls.
  3. Media Capture: Implemented browser-equivalent getUserMedia functionalities for camera and microphone access.
  4. Rendering Layer: Utilized GStreamer and libgtk for efficient video/audio rendering.
  5. Hardware Acceleration: Exploited available GPU resources to offload processing tasks, minimizing CPU load.
  6. Multithreading: Distributed tasks across multiple threads to avoid bottlenecks and ensure smooth video and audio streams.

Beyond Elevators: Broader Industrial Applications

The same WebRTC-based capabilities can revolutionize workflows in:

  • Industry 4.0: Real-time video monitoring of manufacturing processes.
  • Advanced Automotive Use Cases: Video telematics for driver assistance and remote diagnostics.
  • Other Industrial Scenarios: Enhanced safety and communication in mines, oil rigs, and remote construction sites.

Case Study: Revolutionizing Emergency Response for a Global Elevator Manufacturer

Centedge recently partnered with one of the world’s largest elevator manufacturers to design a cutting-edge emergency response system. By adhering to the principles outlined above, we successfully delivered a WebRTC-based two-way video calling system that:

  • Operates seamlessly on low-powered hardware, a dual-core 900Mhz NXP IMX6 processor: This processor is responsible for the entire operation of the Elevator unit including its core Linux-based OS and the entire application layer built on top of the OS layer for smooth elevator operation. The mandate provided to us was to keep the CPU usage < 70% while running a crystal clear audio/video call along with all other elevator processes running. We were able to achieve the mandate while keeping the CPU usage at 62% while running a 2-way WebRTC-powered video call along with all other elevator processes.
  • Provides crystal-clear video and audio streams for real-time communication: The goal was to achieve the best possible audio/ video quality while trying to keep the CPU utilization below 70%. With a lot of experimentation, we found, that 320X240 at 10fps is the sweet spot that provides a clear 2-way audio/video while keeping the overall CPU utilization at 62%.
  • Meets rigorous safety and compliance standards: Rigorous testing was done on the actual production hardware under various scenarios to find out issues and fix them proactively.

This solution significantly reduced response times and enhanced the overall safety of elevator passengers.

Elevator Safety with WebRTC: Conclusion

As the demands for safety and real-time communication continue to grow, Centedge’s unique and custom WebRTC-based solutions are setting new standards for emergency response systems. Whether it’s elevators, industrial workflows, or advanced automotive applications, our technology is designed to adapt and excel in diverse environments. If your organization is looking to enhance safety and operational efficiency, let Centedge tailor a solution that meets your unique requirements.

If you are an Enterprise looking to build Enterprise-Grade Custom Real-Time Audio/Video solutions with hardware integrations for integrating into some of your critical business workflows, here is a link to the list of services we provide for Embedded/IOT integration use cases for WebRTC. Feel free to drop us an email at hello@centedge.io  for a free 30mins strategic discussion session, if you feel a discussion with us would be an important starting point. This session would be exclusively for diving deep into your requirements to provide you with the correct ingredients required to realize your requirements without time and cost overruns. You can reach out to us using this link as well.

Feel free to take a look at the Videoedge Video API/SDK to speed up your development process without having to build the entire application from scratch. With Videoedge SDK, you get the entire backend ready to be deployed into multiple geographies across the world within a week’s time.

References:

Here is a blog we wrote some time ago on how to compile and build the native Libwebrtc for a target CPU type of ARM, responsible for enabling 2-way video calling natively on a hardware device without a dependency on browsers.