jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.87k stars 489 forks source link

Use relative index matching for subtitle selection #4201

Closed nielsvanvelzen closed 5 days ago

nielsvanvelzen commented 5 days ago

When I rewrote the subtitle behavior I did test with media that had both embedded and external subtitles, and in those tests the server would always put all embedded tracks (including audio/video) before external tracks, keeping their indexes the same as you would find them sorted in when inspecting with ffprobe, mkvtoolnix and other tools.

However, this piece of shit API does not always do that. In fact, it can put the external tracks before internal tracks just for funs. This leaves a client literally unable to reliably map a media stream to tracks in their video engine. The hack I've implemented will take all the embedded/hls subtitle streams, filtering out everything else, and then calculate the index. Then does the same when selecting the ExoPlayer track. This should fix all the issues we've encountered (it does so for the media I tested with) but it's still unreliable because this will still fail if the server decided to fuck up the order of these tracks too.

Changes

Issues

Fixes #4183 Maybe fixes #4182

The-Randalorian commented 5 days ago

Confirmed fixes #4182