fix(playback): advertise only webview-decodable audio for video (DR-148, 0.4.7)
The audio codec list sent to Jellyfin comes from MediaCodecList, which describes ExoPlayer — but video does not play through ExoPlayer. Android force-renders every video in the webview <video> element (the interim override in VideoPlayer.svelte) and Linux always has, and Chromium/WebKit decode a far narrower set than the platform does. A motorola edge 30 ships /vendor/etc/media_codecs_dolby_audio.xml, so it reported ac3,eac3; the server direct-played an E-AC-3 track with static=true and the webview built a video decoder and no audio decoder at all — full picture, no sound. The defect is triggered by capability rather than the lack of it, which is why a Fairphone and an Honor tablet play the same file on the same build: without the Dolby decoder they never claim the codec, so the server transcodes to AAC. Confirmed by A/B on the failing device — hevc+eac3 silent, hevc+aac audible, same session, same profile, same direct-play path, audio codec the only variable. video_audio_codecs narrows the platform list to the webview-decodable set for the video direct-play profile only. Audio-only playback really is the native player's, so that profile keeps the full list rather than transcoding music that plays perfectly well. A list with nothing decodable still claims aac, since a profile claiming nothing invites the server to give up instead of transcoding. The video codec list is deliberately untouched: HEVC direct-plays through the webview correctly, so the constraint is specific to audio. Test-first: the tests failed against the old behaviour before the filter existed, including the case built from the phone's real codec list. The requirement-count assertion in extract-traces.test.ts moves 280 -> 281 for the added DR, which is the deliberate edit that test exists to force. Not yet verified on device — the 0.4.7 APK was still building.
This commit is contained in:
@@ -1356,8 +1356,9 @@ impl MediaRepository for OnlineRepository {
|
||||
// Linux desktop plays video through the WebKitGTK HTML5 <video> element,
|
||||
// which cannot reliably decode HEVC/AV1/VP9. Advertise only codecs the
|
||||
// WebView can decode so Jellyfin transcodes anything else to h264 HLS.
|
||||
// (Audio-only files still direct-play via MPV, but the PlaybackInfo
|
||||
// profile is shared, so we keep the broadly-supported audio codecs.)
|
||||
// (Audio-only files still direct-play via MPV; these codecs are what
|
||||
// both renderers handle, and the audio profile keeps them in full while
|
||||
// the video profile is narrowed below.)
|
||||
#[cfg(all(not(target_os = "android"), target_os = "linux"))]
|
||||
let (video_codecs, audio_codecs) =
|
||||
("h264".to_string(), "aac,mp3,opus,vorbis,flac".to_string());
|
||||
@@ -1368,8 +1369,19 @@ impl MediaRepository for OnlineRepository {
|
||||
"aac,mp3,opus,vorbis,flac".to_string(),
|
||||
);
|
||||
|
||||
// Video plays in a webview <video> element on every platform, which
|
||||
// decodes a narrower audio set than the platform does — so the video
|
||||
// profile must claim less than the audio-only profile. Without this a
|
||||
// Dolby-licensed device advertises eac3, gets a direct play, and shows
|
||||
// picture with no sound.
|
||||
let video_audio_codecs = super::device_profile::video_audio_codecs(&audio_codecs);
|
||||
|
||||
info!("[DeviceProfile] Using video codecs: {}", video_codecs);
|
||||
info!("[DeviceProfile] Using audio codecs: {}", audio_codecs);
|
||||
info!(
|
||||
"[DeviceProfile] Audio codecs for video direct play: {}",
|
||||
video_audio_codecs
|
||||
);
|
||||
|
||||
// Bound every profile by what the audio route can actually voice, so a
|
||||
// multichannel track is downmixed by the server rather than direct-played
|
||||
@@ -1388,12 +1400,16 @@ impl MediaRepository for OnlineRepository {
|
||||
profile_type: "Video".to_string(),
|
||||
container: "mp4,mkv,avi,mov,flv,ts,m2ts,webm,ogv,3gp".to_string(),
|
||||
video_codec: Some(video_codecs.clone()),
|
||||
audio_codec: audio_codecs.clone(),
|
||||
// The webview decodes this stream, not ExoPlayer/MPV.
|
||||
audio_codec: video_audio_codecs.clone(),
|
||||
},
|
||||
DirectPlayProfile {
|
||||
profile_type: "Audio".to_string(),
|
||||
container: "mp3,aac,flac,alac,wav,ogg,wma,opus".to_string(),
|
||||
video_codec: None,
|
||||
// Audio-only really is the native player's, so it keeps the
|
||||
// full platform list — narrowing it would transcode music
|
||||
// that plays perfectly well.
|
||||
audio_codec: audio_codecs.clone(),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user