From 258dde6c86c802f7346d5e422f1e09859fa53159 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Sat, 26 Sep 2026 17:39:27 +0000 Subject: [PATCH] drop estimateContentLength from stream URLs The server's byte estimate can be shorter than the transcoded stream, so the player stops at Content-Length and some tracks end early. Let the server stream the true length instead. --- .../com/subtracks/data/source/subsonic/SubsonicSource.kt | 2 -- .../com/subtracks/data/source/subsonic/SubsonicSourceTest.kt | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/subtracks/data/source/subsonic/SubsonicSource.kt b/app/src/main/kotlin/com/subtracks/data/source/subsonic/SubsonicSource.kt index 5505b397..fe9b97d2 100644 --- a/app/src/main/kotlin/com/subtracks/data/source/subsonic/SubsonicSource.kt +++ b/app/src/main/kotlin/com/subtracks/data/source/subsonic/SubsonicSource.kt @@ -136,8 +136,6 @@ class SubsonicSource( "stream", buildMap { put("id", songId) - val transcodes = maxBitrate > 0 || !streamFormat.isNullOrEmpty() - if (transcodes) put("estimateContentLength", "true") if (maxBitrate > 0) put("maxBitRate", maxBitrate.toString()) streamFormat?.takeIf { it.isNotEmpty() }?.let { put("format", it) } }, diff --git a/app/src/test/kotlin/com/subtracks/data/source/subsonic/SubsonicSourceTest.kt b/app/src/test/kotlin/com/subtracks/data/source/subsonic/SubsonicSourceTest.kt index d3d3aca8..874c3f3d 100644 --- a/app/src/test/kotlin/com/subtracks/data/source/subsonic/SubsonicSourceTest.kt +++ b/app/src/test/kotlin/com/subtracks/data/source/subsonic/SubsonicSourceTest.kt @@ -416,7 +416,7 @@ class SubsonicSourceTest { val uri = SubsonicSource(1, client(), maxBitrate = 128).streamUri("s1").toString() assertTrue(uri, uri.contains("maxBitRate=128")) - assertTrue(uri, uri.contains("estimateContentLength=true")) + assertFalse(uri, uri.contains("estimateContentLength")) } @Test @@ -433,7 +433,7 @@ class SubsonicSourceTest { val uri = SubsonicSource(1, client(), streamFormat = "opus").streamUri("s1").toString() assertTrue(uri, uri.contains("format=opus")) - assertTrue(uri, uri.contains("estimateContentLength=true")) + assertFalse(uri, uri.contains("estimateContentLength")) } private fun client() =