mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
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.
This commit is contained in:
@@ -136,8 +136,6 @@ class SubsonicSource(
|
|||||||
"stream",
|
"stream",
|
||||||
buildMap {
|
buildMap {
|
||||||
put("id", songId)
|
put("id", songId)
|
||||||
val transcodes = maxBitrate > 0 || !streamFormat.isNullOrEmpty()
|
|
||||||
if (transcodes) put("estimateContentLength", "true")
|
|
||||||
if (maxBitrate > 0) put("maxBitRate", maxBitrate.toString())
|
if (maxBitrate > 0) put("maxBitRate", maxBitrate.toString())
|
||||||
streamFormat?.takeIf { it.isNotEmpty() }?.let { put("format", it) }
|
streamFormat?.takeIf { it.isNotEmpty() }?.let { put("format", it) }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ class SubsonicSourceTest {
|
|||||||
val uri = SubsonicSource(1, client(), maxBitrate = 128).streamUri("s1").toString()
|
val uri = SubsonicSource(1, client(), maxBitrate = 128).streamUri("s1").toString()
|
||||||
|
|
||||||
assertTrue(uri, uri.contains("maxBitRate=128"))
|
assertTrue(uri, uri.contains("maxBitRate=128"))
|
||||||
assertTrue(uri, uri.contains("estimateContentLength=true"))
|
assertFalse(uri, uri.contains("estimateContentLength"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -433,7 +433,7 @@ class SubsonicSourceTest {
|
|||||||
val uri = SubsonicSource(1, client(), streamFormat = "opus").streamUri("s1").toString()
|
val uri = SubsonicSource(1, client(), streamFormat = "opus").streamUri("s1").toString()
|
||||||
|
|
||||||
assertTrue(uri, uri.contains("format=opus"))
|
assertTrue(uri, uri.contains("format=opus"))
|
||||||
assertTrue(uri, uri.contains("estimateContentLength=true"))
|
assertFalse(uri, uri.contains("estimateContentLength"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun client() =
|
private fun client() =
|
||||||
|
|||||||
Reference in New Issue
Block a user