Update track selection logic for missing IDs#845
Draft
damontecres wants to merge 1 commit intomainfrom
Draft
Conversation
|
Looking forward to testing this. Hope it makes it into next build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a major rewrite of the audio/subtitle track selection logic.
Instead of trying to match the server's index to a track's ID, the implementation now calculates the desired index's offset and uses that to select a track.
This means there is the assumption that that the indexes for each
MediaStreamin theMediaSourceInfowill be ordered as:Note: this assumption is not new, the previous code assumed this as well, but wasn't as upfront about it.
Thus for a file with 1 external subtitle, 1 video, 2 audio, & 3 embedded subtitles and you want the second audo track (index=3):
Related issues
Maybes fixes #791
Testing
Existing unit tests pass. Added additional test cases for a missing ID
I also crafted an mp4 and rewrote the track IDs so there was a gap in the IDs (none with ID=2). Before this PR, Wholphin was unable to switch audio tracks (the official app failed as well). With these change, it can.
I was unable to craft a similar mkv that played successfully and I believe this is because the mkv spec doesn't allow for missing IDs. This is why I'm unsure if #791 is fully resolved by this PR since the OP's issue occurs with a mkv.
Media info
Screenshots
N/A
AI or LLM usage
None