Repository navigation
perf(playback): size the AudioTrack buffer for the speed in use - #750
Merged
Merged
Conversation
Media3 sizes the AudioTrack for 8x speed once playback params are on (2.6 s, 6 s over Bluetooth), and a normal AudioTrack stays silent until that buffer is full. Every start and skip waited 600-800 ms after READY. Size it for the current speed instead; the standby-only override is gone.
The 1 MiB probe past the first MiB ran before every first audio and took 0.25-2 s on songs the googlevideo edge hasn't cached. Playback resolves now return the first candidate and probe 5 s later, once the player has its first bytes (overlapping, the probe doubled the player's first-byte time). A failed probe cools the client down so the player's retry, which resumes at the same position, gets a fresh URL. Downloads and the mid-stream URL refresh still probe before use.
Contributor
Author
|
Added df68713: the 1 MiB stream probe no longer blocks first audio. The probe reads 1 MiB past the first MiB before playing. On songs the googlevideo edge hasn't cached that took 0.25-2 s per tap. Playback now starts on the resolved URL and probes 5 s later; a failed probe cools that client down so the existing retry (resumes at the same position) picks a fresh URL. Downloads and the mid-stream URL refresh still probe first. OnePlus Pad 2, in-app search taps:
Not tested: downloads, a real bad-URL recovery. |
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.
Media3 sizes the AudioTrack for 8x speed when playback params are on: 2.6 s (6 s on Bluetooth). Android stays silent until that buffer is full, so every start and skip sat 600-800 ms after READY.
Size the buffer for the current speed (320 ms at 1x). The automix-standby-only override is removed since it's now the default.
Tested on OnePlus Pad 2, Fast start:
Not tested: Bluetooth, USB DAC, changing speed above 1x mid-song.