perf: prioritize audio preroll after paused network previews

This commit is contained in:
2026-10-17 02:00:04 +02:00
parent e1284936f9
commit 0aa0ed781f
5 changed files with 118 additions and 47 deletions
+5 -1
View File
@@ -1117,8 +1117,12 @@ struct Player {
bool decodeOne(bool stepping = false) {
for (const auto &input : inputs)
if (input) check(input->error(), "Reading network media");
// Once a paused network preview is shown, finish audio preroll first.
// Video remains a fallback so a combined reader can relieve byte pressure.
const int firstSlot = network && status == PLAYER_PAUSED && previewShown && !stepping ?
0 : nextDecodeSlot;
for (int offset = 0; offset < 2; ++offset) {
const int slot = (nextDecodeSlot + offset) % 2;
const int slot = (firstSlot + offset) % 2;
auto &track = tracks[slot];
if (!track.codec || track.drained || (stepping && slot == 0)) continue;
if (slot == 0 && pcmOffset < pcmFrames) continue;