Speed-cap and progress math use a hard-coded 320 kbps assumption instead of the track's real bitrate #16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The speed-cap throttle and all UI progress math (position, percentage, ETA, speed multiplier) assume every track is encoded at a flat 320 kbps, via the hard-coded constant
OGG_320_BYTES_PER_SEC = 40_000(bytes/sec) insrc/download/worker.rs. This value is passed unconditionally regardless of which audio format a given track actually resolves to.This also contradicts
specs/core_architecture.md, which currently documentsTrack.duration_secsas the input to speed-cap byte-rate calculation — that is not what the code does today.Details
src/download/worker.rs:19definesOGG_320_BYTES_PER_SEC: u64 = 40_000.audio_bytes_per_secintowrite_stream's speed-cap throttle (worker.rs:250-254) unconditionally, from bothsrc/download/session.rs:129(interactive mode) andsrc/cli/script.rs:106(script mode).src/ui/progress.rs:239,249) uses the same constant — nottrack.duration_secs— to derive percentage, position ("elapsed"), ETA, and the speed multiplier for every entry.open_stream, insrc/provider/spotify/stream.rs:83-84(select_audio_format→bps), but this value is never surfaced back to the worker or the UI — it's discarded after Stage 1 starts.Proposed fix
Thread the real per-format byte rate (already computed in
src/provider/spotify/stream.rsasbps) through to the worker and the UI, replacing the hard-codedOGG_320_BYTES_PER_SECconstant at both call sites. Alternatively/additionally, correctspecs/core_architecture.md's existing claim so the doc matches whichever behavior is implemented.