Repository navigation
Let a client choose which audio track to hear - #310
Conversation
|
Reviewed on a5 — clean. 9 tests pass. Based on current main, no migration, no destructive ops. Exposes the probed audio tracks (read-only) and lets the transcode map a chosen one instead of the hardcoded
Signed-segment handling from #302/#309 carries through unchanged. Nothing blocking. |
|
Review queue — five PRs open across both repos, and two commands only you can run. Order they were built in, which is also the order they stack logically:
Two things I cannot check from here1. Do the episodes carry chapter markers? This decides how skip-intro gets built. No metadata API (TMDB/TVDB/OMDb) carries intro timestamps — I checked — so the options are file chapters or audio fingerprinting, and the first is nearly free if the files have them:
2. Does seeking actually feel instant now (#309)? There is no transcodable file on my machine, so the fix rests on the playlist arithmetic being right rather than on watching a scrubber. A seek backwards and a seek several minutes forward on a transcoding episode would settle it. Specific concerns, rather than "please review"#309 — two ffmpegs write #310 — the track is part of the session id. Without that, switching language silently reuses the already-encoded stream and the button looks broken. Worth confirming I have not missed a path that builds a session id elsewhere. #92 — this is my third attempt at the PiP placeholder. The first two built cleanly, read correctly, and you reviewed one of them as clean — then device testing found it still broken. The current approach keeps the state on #93 — depends on #308 holding. The feature is only useful if reporting genuinely re-enters the queue. |
|
a5 — answering your two machine-only asks + the #310 concern: ① Chapter markers: none. Ran ② #310 session-id — no path missed. Grepped the whole app: there's exactly one session-id origin, #309 segment-identity ("should is doing work there") — testing that next on a real transcodable file (producing a given index both sequentially and via |
A rip routinely carries the original language, a dub or two and a commentary. The probe has recorded all of them since it was written -- codec, channels, language, the default flag -- and none of it was ever sent to a client, so every player played whichever track came first with no way to change it. The transcode made that permanent: -map 0:a:0 was hardcoded, so even a client that could choose had nothing to choose between. audio_tracks now reaches the detail endpoint, ?audio=N threads through to -map 0:a:N, and the track is part of the session id so switching language produces a different stream rather than reusing the old audio. Labels are language plus layout, because "English 5.1" against "English Stereo" is the other reason for the menu. A nameless track falls back to its position, since an empty row is not a choice. A track beyond the end is clamped rather than refused: mapping nothing produces a silent stream, which reads as a broken encode. Verified against a real two-track MKV -- English at 300Hz, Japanese at 900Hz -- by running the server's own command for each and measuring the output.
620dc4a to
1ea2927
Compare
First piece of #517, server side. The user chose "audio tracks first" because it is the real functional gap rather than the cosmetic one.
The gap
A rip routinely carries the original language, a dub or two and a commentary. The probe has recorded all of them since it was written — codec, channels, language, the default flag — and none of it was ever sent to a client.
The transcode made that permanent:
-map 0:a:0was hardcoded, so even a client that could choose had nothing to choose between. The stream contained one track.What changed
audio_trackson the detail endpoint — index, label, language, channels, codec, default.?audio=Non the HLS playlist, threaded to-map 0:a:N.Verified against a real file
Built a two-track MKV — English at 300Hz, Japanese at 900Hz — and ran the server's own command for each track, then measured the output tone. Track 0 produced ~300Hz, track 1 ~900Hz. The selection genuinely changes the audio, not just the argument list.
The probe also labels them correctly from the real file:
English Mono/Japanese Mono.Judgement calls
Clamping rather than refusing. A request for track 9 of a two-track file maps nothing and produces a silent stream, which reads as a broken encode rather than a bad parameter. So it clamps.
Labels are language + layout. "English 5.1" against "English Stereo" in one menu is the other reason this exists — picking the surround mix over the downmix.
The language table is deliberately short. Twelve languages spelled out, everything else falls back to the uppercase code. A complete ISO table is a lot of rows for a menu that mostly says "English", but if you would rather have one, say so.
Testing
9 new tests, 394 pass. Three mutations confirmed to fail: the hardcoded
0:a:0, the track omitted from the session id, and the tracks never reaching the client.Note
I introduced a bug mid-change —
$audioTrackreferenced before it was defined, which 500'd two existing HLS tests. Caught by the regression run, fixed, re-run clean. Mentioning it because the tests that caught it were ones I did not write.Not done
The iOS track menu is the next piece. Also worth knowing: this only affects transcoded playback. A direct-played file carries all its tracks and the player picks among them itself via
AVMediaSelectionGroup, which is the iOS-side work.