How Janus and Baidu WebRTC relate

发布于:2025-04-09 ⋅ 阅读:(37) ⋅ 点赞:(0)

The relationship between Janus Gateway and Baidu WebRTC (libwebrtc) is subtle but important. Here’s a breakdown:


🔗 How Janus and Baidu WebRTC relate

Janus Gateway Baidu WebRTC (libwebrtc)
What it is A media server for WebRTC (written in C) The WebRTC implementation used in browsers (C++)
Role Server-side handler for WebRTC sessions, SFU Client-side WebRTC stack (browsers, mobile SDKs)
Uses libwebrtc? No, it does not use Baidu’s libwebrtc ✅ Yes, used in Chrome, Firefox, Android, etc.
Language Written in C (not C++) Written in C++, designed for browsers & apps
Focus Routing, mixing, recording, plugins PeerConnection, ICE, DTLS, codecs

🧩 So how do they “work together”?

When you use Janus Gateway with a browser:

  • The browser side uses Baidu’s libwebrtc under the hood to handle:

    • Media capture
    • ICE negotiation
    • DTLS/SRTP encryption
    • Codec handling
  • The Janus server:

    • Accepts and handles WebRTC signaling
    • Terminates ICE/DTLS/SRTP connections
    • Acts as a Selective Forwarding Unit (SFU) — relaying video/audio streams
    • Provides plugins (e.g., video room, echo test, streaming, etc.)

🧠 Even though Janus doesn’t use libwebrtc, it implements the WebRTC protocol stack on the server side — in its own way, written from scratch in C.


🛠️ Why Janus avoids libwebrtc

Janus authors chose not to use Baidu’s libwebrtc because:

  • It’s a huge and complex dependency
  • It’s hard to embed into C-based projects
  • It’s focused on peer-to-peer and client-side use cases
  • Janus only needs enough of the protocol to terminate and route streams

🎯 Summary

  • Janus Gateway is a standalone WebRTC server implementation — written in C, not using libwebrtc
  • Browsers use Baidu’s libwebrtc to talk WebRTC protocols
  • They interoperate via standard protocols: ICE, DTLS, SRTP, SDP

If you’re building with WebRTC in the browser and using Janus, you’re bridging Baidu’s libwebrtc (browser) to Janus (server) over standard protocols.


网站公告

今日签到

点亮在社区的每一天
去签到