fix(download): compare size estimates at each quality tier

This commit is contained in:
zarzet
2026-09-06 21:55:38 +07:00
parent c6195bcd10
commit ba00807786
7 changed files with 102 additions and 59 deletions
+7 -3
View File
@@ -173,15 +173,19 @@ for custom IDs without resolving streams or triggering verification:
- For compressed lossless audio, supply `bitDepth` and `sampleRate` in Hz.
`channels` defaults to 2. Do not use this model for uncompressed PCM.
- Set `isMaximum: true` for a lossless tier that can return lower quality. Its
estimate spans CD quality through the declared maximum. A capped bitrate
alone cannot supply a useful range and is shown as unavailable.
estimate uses the declared depth/rate and explicitly labels that assumption
(for example, “≈ 171.4 MB if 24-bit/192kHz”). It does not predict which quality
the provider will actually return. A capped bitrate alone remains unavailable.
- Omitted parameters remain unknown. Older extensions retain estimates for
the picker's legacy `LOSSLESS`, `HI_RES`, and `HI_RES_LOSSLESS` tiers and
explicit codec/bitrate IDs or labels such as `opus_256` or `Opus 256kbps`.
Generic `best`, `high`, `low`, and spatial tiers need explicit parameters.
Lossy estimates use duration × bitrate / 8. Lossless estimates use a rough
5080% of uncompressed PCM size; this is a heuristic, not a guaranteed range.
65% of uncompressed PCM size at the declared quality. This is a comparison
heuristic, not measured compression for the recording or a guaranteed size.
Do not combine a CD-quality minimum with a hi-res maximum: that range hides
the distinction between tiers and provides little useful size information.
Estimates exclude artwork, tags, and container overhead. They describe the
selected quality before automatic conversion, with a separate converted-size
estimate when enabled. Fallback quality and intermediate transfers can change