Speak protocol 3.0 and fall back to 2.0 only when that is the reflector's maximum.

A reflector that has moved to 3.0 will not accept a station that always announces 2.0, and a 2.x reflector still needs one explicit plaintext session.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 14:24:00 +02:00
co-authored by Cursor
parent 0930d4b727
commit 3d1a2a1669
24 changed files with 3180 additions and 244 deletions
+12
View File
@@ -5,6 +5,10 @@ package opus
#cgo pkg-config: opus
#include <opus.h>
static void reset_decoder(OpusDecoder *dec) {
opus_decoder_ctl(dec, OPUS_RESET_STATE);
}
static int configure_encoder(OpusEncoder *enc) {
int err;
err = opus_encoder_ctl(enc, OPUS_SET_BITRATE(20000));
@@ -114,6 +118,14 @@ func (d *Decoder) Decode(packet []byte) ([]int16, error) {
return pcm, nil
}
// Reset clears decoder state after a gap in the received audio.
func (d *Decoder) Reset() {
if d == nil || d.dec == nil {
return
}
C.reset_decoder(d.dec)
}
// Close releases the decoder.
func (d *Decoder) Close() {
if d == nil || d.dec == nil {