pi-webrtc

DataChannels

這一頁還沒有中文版,以下顯示英文原文。

pi-webrtc uses WebRTC DataChannels for commands, file transfers and IPC messages. This page lists the channels, which signaling carries them, and the commands that they carry.

Channels

LabelOrderedDeliveryCarries
commandyesreliableCommands and small answers, such as the recording status
streamnoreliableLarge data, such as snapshots, file lists and files
_lossynomay drop messagesIPC messages where old data can be dropped
_reliableyesreliableIPC messages that must arrive

_lossy and _reliable also need --enable-ipc. See IPC messages.

Large transfers use stream, so they never block commands. Several transfers can run at the same time.

Which signaling carries which channel

LabelMQTTWHEPLiveKitCloudflare
command✅❌❌❌
stream✅❌❌❌
_lossy✅❌✅❌
_reliable✅❌✅❌

WHEP and Cloudflare carry no DataChannel at all. SFU viewers never get command and stream, so snapshots, recording control, camera control and file transfer only work over MQTT. You can turn on --use-mqtt next to an SFU to keep them.

Commands

The messages are Protocol Buffers, defined in packet.proto. client-sdk-js wraps them in methods, so most apps never build them by hand.

RequestWhat it doesAnswer
take_snapshotTakes one JPEG at the given quality (0 to 100)The JPEG, on stream
control_cameraChanges an image control, such as brightnessNone
start_recordingStarts on-demand recordingrecording, with is_recording: true and the file path
stop_recordingStops on-demand recordingrecording, with is_recording: false and the file path
query_fileLists recordingsThe file list, on stream
transfer_fileDownloads a fileThe file, on stream
toggle_trackingTurns the tracking overlay on or off. Jetson sponsor build only.toggle_tracking
disconnectTells the device that the client is leavingNone

Every request has a request_id. The device puts the same id on its answer, so the client knows which request it answers.

See Recording for the details of query_file.

在 GitHub 上編輯此頁

本頁內容