Open Romantic-LiXuefeng opened 2 years ago
Another important aspect when switching HLS tracks would be an option to apply the new track selection only when fetching new segments instead of discarding the current cache and switching immediately.
This is useful when track changes are meant to change the bitrate/resolution. Fetching segments that are already cached might not be desired depending on the networking conditions. Also, while watching a livestream it is usually not desired to discard segments from the cache which are expired from the remote server and can't be fetched again. Depending on the available RAM it can be very useful to allocate a lot of memory for mpv's demuxer cache to allow pausing a livestream without missing anything.
Possibly worth its own issue?
Before requesting a new feature make sure it hasn't been requested yet. https://github.com/mpv-player/mpv/labels/meta%3Afeature-request
Expected behavior of the wanted feature
HLS master playlist As the link in HLS draft description , if the HLS master playlist without Alternative Audio or Video, we could assume the different variant streams in master playlist contains the same audio codec attributes(eg. same codec, same channel count, same sample rate..). So to the player track interface, there should be only one audio track and some different video tracks, the user could only switch between video tracks.
Now in current implementation, the
mpv player
parsers all audio tracks from different variant streams in master playlist and thinks the audio tracks are different, and exposés the audio tracks to switch.For example, if the mpv player switch video track from low[low.m3u8] to high[hi.m3u8], but the audio track still consume from low[low.m3u8] stream, At the same time , there are two parallel streams(http connections) to request, it's the waste of
network. More serious happened if we switch between the audios, there is obviously a/v not in sync. and if we first switch the audio track and then to switch the video track, the switch(seek) point become discontinue, the switch(seek) result is the player start playback at different position.
Log file
Reproduction steps:
to:
then
to:
then:
The log file: mpv.log