stop estimating a length for Ogg-based transcodes

Streaming Opus from Navidrome failed the first play with a read out of range,
then worked. Ogg seeks by binary-searching for the last page from the end of the
file, and the length the app estimates for a transcode overshoots the real
output, so that search reads past the data and the server answers 416. Opus,
Ogg and Vorbis now get no estimate: seeking falls back to what is buffered, but
playback is not scuppered by a length we cannot know. Downloads were unaffected
because they never carried the estimate.
This commit is contained in:
austinried
2026-10-04 00:30:04 +00:00
parent c3f4969911
commit b6a2f89d6f
2 changed files with 13 additions and 0 deletions
@@ -39,6 +39,13 @@ class StreamLengthTest {
assertTrue(cdQuality >= 320 * 1_411_200 / 8)
}
@Test
fun oggBasedFormatsGetNoEstimateBecauseSeekingReadsFromTheEnd() {
assertNull(declaredStreamLength(180_000, StreamQuality(128, "opus")))
assertNull(declaredStreamLength(180_000, StreamQuality(128, "ogg")))
assertNull(declaredStreamLength(180_000, StreamQuality(128, "vorbis")))
}
@Test
fun theLengthSuffixRoundTripsThroughTheFragment() {
val uri = "http://host/rest/stream.view?id=s1" + streamLengthSuffix(1_234_567)