[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:
@@ -232,7 +232,7 @@ fn run_capture(
|
|||||||
};
|
};
|
||||||
let mut encoder =
|
let mut encoder =
|
||||||
opus::Encoder::new(info.sample_rate, opus_channels, opus::Application::Audio)?;
|
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 mut opus_buf = vec![0u8; 4096];
|
||||||
|
|
||||||
let (sample_tx, sample_rx) = std_mpsc::sync_channel::<Vec<f32>>(64);
|
let (sample_tx, sample_rx) = std_mpsc::sync_channel::<Vec<f32>>(64);
|
||||||
@@ -251,8 +251,9 @@ fn run_capture(
|
|||||||
|
|
||||||
stream.play()?;
|
stream.play()?;
|
||||||
info!(
|
info!(
|
||||||
"Audio bridge capture active on '{}'",
|
"Audio bridge capture active on '{}' ({} bps)",
|
||||||
device.name().unwrap_or_else(|_| "unknown".to_string())
|
device.name().unwrap_or_else(|_| "unknown".to_string()),
|
||||||
|
cfg.bitrate_bps
|
||||||
);
|
);
|
||||||
|
|
||||||
let tx_gain = cfg.tx_gain.max(0.0);
|
let tx_gain = cfg.tx_gain.max(0.0);
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ pub struct AudioBridgeConfig {
|
|||||||
pub rx_output_device: Option<String>,
|
pub rx_output_device: Option<String>,
|
||||||
/// Local input device for TX uplink capture.
|
/// Local input device for TX uplink capture.
|
||||||
pub tx_input_device: Option<String>,
|
pub tx_input_device: Option<String>,
|
||||||
|
/// Opus bitrate in bits per second for TX uplink capture.
|
||||||
|
pub bitrate_bps: u32,
|
||||||
/// RX playback gain multiplier.
|
/// RX playback gain multiplier.
|
||||||
pub rx_gain: f32,
|
pub rx_gain: f32,
|
||||||
/// TX capture gain multiplier.
|
/// TX capture gain multiplier.
|
||||||
@@ -144,6 +146,7 @@ impl Default for AudioBridgeConfig {
|
|||||||
enabled: false,
|
enabled: false,
|
||||||
rx_output_device: None,
|
rx_output_device: None,
|
||||||
tx_input_device: None,
|
tx_input_device: None,
|
||||||
|
bitrate_bps: 192000,
|
||||||
rx_gain: 1.0,
|
rx_gain: 1.0,
|
||||||
tx_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());
|
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(
|
validate_tokens(
|
||||||
"[frontends.http_json.auth].tokens",
|
"[frontends.http_json.auth].tokens",
|
||||||
&self.frontends.http_json.auth.tokens,
|
&self.frontends.http_json.auth.tokens,
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ impl Default for AudioConfig {
|
|||||||
sample_rate: 48000,
|
sample_rate: 48000,
|
||||||
channels: 1,
|
channels: 1,
|
||||||
frame_duration_ms: 20,
|
frame_duration_ms: 20,
|
||||||
bitrate_bps: 24000,
|
bitrate_bps: 192000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user