sf-ui 0.1.4: video sound always decoded (no AC3 passthrough)
All checks were successful
ci / test (push) Successful in 21m47s

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 <noreply@anthropic.com>
This commit is contained in:
Tamas Csikel
2026-11-02 20:27:46 +01:00
parent 629f647728
commit 54905d5f10
3 changed files with 15 additions and 10 deletions

View File

@@ -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);