[feat](trx-server,trx-client): raise default audio opus bitrate

Co-authored-by: Codex <codex@openai.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-02-28 11:33:52 +01:00
parent b0bf9e3ee0
commit 4b5dd36778
3 changed files with 11 additions and 4 deletions
+4 -3
View File
@@ -232,7 +232,7 @@ fn run_capture(
};
let mut encoder =
opus::Encoder::new(info.sample_rate, opus_channels, opus::Application::Audio)?;
encoder.set_bitrate(opus::Bitrate::Bits(24_000))?;
encoder.set_bitrate(opus::Bitrate::Bits(cfg.bitrate_bps as i32))?;
let mut opus_buf = vec![0u8; 4096];
let (sample_tx, sample_rx) = std_mpsc::sync_channel::<Vec<f32>>(64);
@@ -251,8 +251,9 @@ fn run_capture(
stream.play()?;
info!(
"Audio bridge capture active on '{}'",
device.name().unwrap_or_else(|_| "unknown".to_string())
"Audio bridge capture active on '{}' ({} bps)",
device.name().unwrap_or_else(|_| "unknown".to_string()),
cfg.bitrate_bps
);
let tx_gain = cfg.tx_gain.max(0.0);
+6
View File
@@ -132,6 +132,8 @@ pub struct AudioBridgeConfig {
pub rx_output_device: Option<String>,
/// Local input device for TX uplink capture.
pub tx_input_device: Option<String>,
/// Opus bitrate in bits per second for TX uplink capture.
pub bitrate_bps: u32,
/// RX playback gain multiplier.
pub rx_gain: f32,
/// TX capture gain multiplier.
@@ -144,6 +146,7 @@ impl Default for AudioBridgeConfig {
enabled: false,
rx_output_device: None,
tx_input_device: None,
bitrate_bps: 192000,
rx_gain: 1.0,
tx_gain: 1.0,
}
@@ -367,6 +370,9 @@ impl ClientConfig {
{
return Err("[frontends.audio.bridge].tx_gain must be finite and >= 0".to_string());
}
if self.frontends.audio.bridge.bitrate_bps == 0 {
return Err("[frontends.audio.bridge].bitrate_bps must be > 0".to_string());
}
validate_tokens(
"[frontends.http_json.auth].tokens",
&self.frontends.http_json.auth.tokens,
+1 -1
View File
@@ -267,7 +267,7 @@ impl Default for AudioConfig {
sample_rate: 48000,
channels: 1,
frame_duration_ms: 20,
bitrate_bps: 24000,
bitrate_bps: 192000,
}
}
}