RadioConsole2 icon indicating copy to clipboard operation
RadioConsole2 copied to clipboard

Adaptive timestamp synchronization for status/audio

Open W3AXL opened this issue 6 months ago • 1 comments

A core component of RC2 is keeping audio and status/control data in-sync with each other. WebSocket commands & status messages arrive in realtime (sans any network latency), while audio may arrive with a substantial (~300ms or more) delay. Currently, we use the WebRTC RoundTripTime statistic, plus a manually determined "fudge factor", to come up with a proper timing offset to delay status & command updates to be properly synced with incoming/outgoing audio.

A better method would be to use the RTP extensions for WebRTC to embed the absolute capture NTP timestamp of each audio packet, and embed the same NTP timestamp into each Websocket message. Then, at either end, we can compare these two timestamps and delay the Websocket messages by an appropriate amount of time, updated dynamically every n seconds.

W3AXL avatar Jun 26 '25 15:06 W3AXL

More reference:

SipSorcery: https://github.com/sipsorcery-org/sipsorcery/pull/1182

WebRTC: https://w3c.github.io/webrtc-extensions/#rtp-header-extension-control-transceiver-interface

W3AXL avatar Jun 26 '25 16:06 W3AXL