devgianlu / go-librespot

Yet another open source Spotify client, written in Go.
GNU General Public License v3.0
53 stars 7 forks source link

feat: improved seeking #3

Closed devgianlu closed 9 months ago

devgianlu commented 9 months ago

This is an attempt at improving the seeking algorithm. The old way is completely bogus because lots of error adds up when seeking far from the beginning of the stream. The method implement now requires to fetch the entire stream to find the precise location which is not ideal.

This changes are required for a good playback experience on devices that use very long output buffers (pipewire on Fedora default to 10s): when pausing we throw away 10s of frames which must be rewinded in the decoder before resuming playback or they'll be lost.

Currently reverse enginnering the propertary seek table in the first ogg metadata page (mentioned here).