Expand description
Tier 3: deep D-STAR protocol connections and voice capture.
Establishes full D-STAR protocol connections (DPlus, DExtra, DCS) to
reflectors via the dstar-gateway crate’s AsyncSession API. Captures
voice streams including:
- D-STAR header metadata (callsign, suffix, UR call, RPT fields)
- AMBE voice frames decoded to PCM via
mbelib-rs, then encoded to MP3 - Slow data (D-STAR text messages, DPRS position reports)
The capture pipeline for each stream:
AsyncSession<P> -> VoiceStart (header)
-> VoiceFrame x N (AMBE + slow data)
-> VoiceEnd
|
mbelib-rs: AMBE -> PCM
|
mp3lame-encoder: PCM -> MP3
|
Postgres: streams table (metadata + audio_mp3)Connections are managed by a priority queue: user-pinned reflectors take precedence, followed by auto-promoted reflectors ranked by activity score. Idle sessions (no voice activity beyond the configured timeout) are disconnected to free slots for more active reflectors.
§Module layout
decoder— AMBE-to-PCM-to-MP3 audio pipeline usingmbelib-rsandmp3lame-encoder.capture— Per-stream state tracker (StreamCapture) and cross-stream dispatcher (CaptureManager).
§Current status
The audio decode pipeline and capture-state machinery are complete and
unit-tested. The remaining orchestration work — maintaining a pool of
AsyncSession tasks keyed off the Tier 1/Tier 2 reflector scores — is
left to a follow-up. The public run entry point currently logs its
configuration and blocks forever; process_completed_stream is the
production-grade finalizer that the future orchestrator will wire in.
Modules§
Functions§
- process_
completed_ 🔒stream - Finalizes one captured voice stream: MP3-encodes the audio and persists
the row to
PostgreSQL. - run 🔒
- Runs the Tier 3 voice capture orchestrator.