Optimizing librespot seeking and streaming performance #158
Replies: 1 comment
-
If I understand correctly, you keep the one background thread downloading the song, and spawn a new connection for each seek then? If that's correct, I wonder how that compares to using a single HTTP connection and issuing smaller range requests on the same connection. I believe this is possible with HTTP, but its been a while! 😅 Ultimately, removing as many seeks as possible is the best optimization though :)
So, internally When the ring buffer is empty, or it has been entirely consumed, The size of those chunks that are read from underlying So when a demuxer is simply consuming the media sequentially, The reason why
In practice, these requirements mean that the ring buffer can't be smaller than 64 kB. We also have the function
I think first we need to prove that's how the seek table works. Since you mentioned that The following command can be used to dump all the packet information to a file:
If this is how the seek table works, then I think we may need to make it an optional feature of the Symphonia OGG demuxer since it's a proprietary feature of Spotify. Or, like you suggested, maybe we have to provide a way for external users to hook in custom packet parsers... Going to need to have a think on that one. |
Beta Was this translation helpful? Give feedback.
-
Sorry to have hijacked #154! Continuing here.
😄 this is all in
librespot
today.It does trigger me to immediately launch a new thread when in seeking mode, and not await the current sequential chunk. Yes it will share bandwidth, but is likely to have better latency.
While getting the desired/suggested chunk size from Symphonia would be great, <32 kB chunks does not seem ideal for HTTPS. It would result in many network requests with a relatively low header-to-content ratio.
I am a bit confused about the minimum
buffer_len
inMediaSourceStreamOptions
and how that relates to the 1-32 kB buffer you describe. The documentation states thatbuffer_len
must be >32 kB and a power of two. Indeed setting it to <64 kB returnsthread '<unnamed>' panicked at 'assertion failed: options.buffer_len > Self::MAX_BLOCK_LEN'
.Well thought out! Assuming that were the case, how would that best work its way into Symphonia? I think it would need to be an extension there somewhere, fed by
librespot
?Beta Was this translation helpful? Give feedback.
All reactions