From 54905d5f10b931b17233f8cf473ac1c7daa13fd4 Mon Sep 17 00:00:00 2001 From: Tamas Csikel Date: Mon, 2 Nov 2026 20:27:46 +0100 Subject: [PATCH] sf-ui 0.1.4: video sound always decoded (no AC3 passthrough) When the HDMI sink also offers AC3/E-AC3 passthrough (WirePlumber's iec958 codecs), pulsesink took the encoded track as it was: a 44.1 kHz AC3 track failed at once ("Failed to connect stream: No such entity") and a 48 kHz one went out as a bitstream that stuttered on a Raspberry Pi 4. The player's audio sink is now audioconvert ! audioresample ! audio/x-raw ! pulsesink, so it always gets PCM. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- sf-ui/src/video.rs | 15 ++++++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15ca37f..8037801 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4810,7 +4810,7 @@ dependencies = [ [[package]] name = "sf-app" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "log", @@ -4820,7 +4820,7 @@ dependencies = [ [[package]] name = "sf-pack" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "ruzstd", @@ -4832,7 +4832,7 @@ dependencies = [ [[package]] name = "sf-ui" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "glow 0.16.0", @@ -4848,7 +4848,7 @@ dependencies = [ [[package]] name = "sf-ui-gallery" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 2de7606..7ede750 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["sf-app", "sf-ui", "sf-ui/gallery", "sf-pack"] exclude = ["templates/rust-app"] [workspace.package] -version = "0.1.3" +version = "0.1.4" edition = "2024" license = "MIT" repository = "https://gitea.bluefox.support/fennec/sdk" diff --git a/sf-ui/src/video.rs b/sf-ui/src/video.rs index 4ef4937..e4c1057 100644 --- a/sf-ui/src/video.rs +++ b/sf-ui/src/video.rs @@ -229,11 +229,16 @@ impl Player { Err(e) => log::warn!("video: vapostproc: {e}"), } } - if let Some(audio) = ["pulsesink", "pipewiresink"] - .iter() - .find_map(|n| gst::ElementFactory::make(n).build().ok()) - { - playbin.set_property("audio-sink", &audio); + // Always decoded sound (PCM). When the HDMI sink also offers AC3/E-AC3 + // passthrough, pulsesink would take the encoded track as it is: a + // 44.1 kHz AC3 track then fails ("Failed to connect stream: No such + // entity") and a 48 kHz one goes out as a bitstream that stutters on + // the Raspberry Pi. + if let Some(sink) = ["pulsesink", "pipewiresink"].into_iter().find(|n| gst::ElementFactory::find(n).is_some()) { + match gst::parse::bin_from_description(&format!("audioconvert ! audioresample ! audio/x-raw ! {sink}"), true) { + Ok(bin) => playbin.set_property("audio-sink", &bin), + Err(e) => log::warn!("video: audio sink: {e}"), + } } playbin.set_property("subtitle-font-desc", opts.subtitle_font.as_str()); playbin.set_property("av-offset", opts.audio_offset_ms * 1_000_000);