vios-deep-stream-bridge · git:20260603.14e198c · 2026-06-03 · sha256 155584061f1aaf79
vios-deep-stream-bridge git:20260603.14e198cA
Immutable. This exact content is served forever at /api/v1/blob/155584061f1aaf79.
---
description: "Deep reference: Stream bridge module -- WebRTC in/out, external peers, gRPC callbacks, data channel"
globs: "src/modules/webrtc_stream_bridge/**"
alwaysApply: false
---
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Stream Bridge Module
## Architecture
`StreamBridgeService` wraps `PeerConnectionManager("streambridge", ..., monitor=true)`. Combines sensor management, RTSP proxy, recording, and WebRTC streaming into a single module.
## Key Differences from Live/Replay
- Supports both WebRTC-in (ingress: `m_peerInputConnections`) and WebRTC-out (egress: `m_peerConnectionMap`)
- External peer connections via gRPC or WebSocket (`m_remoteConnections`)
- Data channel support (`isDataChannel` in start request)
- Connection limits: `isWebrtcOutLimitCrossed()`, `isWebrtcInLimitCrossed()`
## External vs Internal Peers
- **Internal**: Direct HTTP to Stream Bridge REST APIs -> `PeerConnectionManager`
- **External**: Peers in `m_remoteConnections` (streamIds). SDP/ICE routed via gRPC callbacks:
- `/grpc/remotePeerOffer` -> `SendRemotePeerOffer`
- `/grpc/remotePeerAnswer` -> `parseRemoteAnswer`
- `/grpc/remotePeerSendIceCandidate` -> remote ICE
- `/grpc/remotePeerErase` -> remove from `m_remoteConnections`
## gRPC Integration
Registered via `addRequestHandler()`:
- `/grpc/addUdpTrack` -> `AddTrackToExistingPeerConnection`
- `/grpc/udpToWebrtc` -> UDP to WebRTC conversion
- `/grpc/setWebrtcClientParams` -> client parameters
## API Endpoints
Standard WebRTC APIs (`stream/start`, `stop`, `setAnswer`, `iceCandidate`, `iceServers`) plus `configuration`, `version`, `help`, `stream/*` (picture).