Stabilize live playback audio
Some checks are pending
ci-gates / checks (push) Waiting to run
deploy-cloudflare / checks (push) Waiting to run
deploy-cloudflare / deploy (push) Blocked by required conditions

This commit is contained in:
every.channel 2026-05-03 20:52:41 -07:00
parent 0d86104762
commit 64e5ee3965
No known key found for this signature in database
4 changed files with 122 additions and 6 deletions

View file

@ -19,6 +19,8 @@ use std::process::{Child, Command, Stdio};
#[cfg(feature = "ffmpeg-ffi")]
use std::time::Duration;
pub const LIVE_AUDIO_RESAMPLE_FILTER: &str = "aresample=async=1000:min_hard_comp=0.100:first_pts=0";
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StreamProbe {
pub index: usize,
@ -804,12 +806,18 @@ pub fn deterministic_h264_profile() -> DeterminismProfile {
encoder_args: vec![
"-c:a".to_string(),
"aac".to_string(),
"-profile:a".to_string(),
"aac_low".to_string(),
"-b:a".to_string(),
"128k".to_string(),
"-ac".to_string(),
"2".to_string(),
"-ar".to_string(),
"48000".to_string(),
"-af".to_string(),
LIVE_AUDIO_RESAMPLE_FILTER.to_string(),
"-max_muxing_queue_size".to_string(),
"2048".to_string(),
"-pix_fmt".to_string(),
"yuv420p".to_string(),
"-g".to_string(),
@ -876,6 +884,15 @@ mod tests {
assert!(args.iter().any(|a| a == "1"));
assert!(args.iter().any(|a| a == "+bitexact"));
assert!(args.iter().any(|a| a == "libx264"));
assert!(args
.windows(2)
.any(|w| w[0] == "-profile:a" && w[1] == "aac_low"));
assert!(args
.windows(2)
.any(|w| w[0] == "-af" && w[1] == LIVE_AUDIO_RESAMPLE_FILTER));
assert!(args
.windows(2)
.any(|w| w[0] == "-max_muxing_queue_size" && w[1] == "2048"));
}
#[test]