mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-29 22:24:29 +02:00
Fixed local Dash webm video casting
This commit is contained in:
parent
1e941cf6c5
commit
0a8e96cac8
@ -46,7 +46,8 @@ class HttpFileHandler(method: String, path: String, private val contentType: Str
|
|||||||
}
|
}
|
||||||
|
|
||||||
var totalBytesSent = 0
|
var totalBytesSent = 0
|
||||||
val contentLength = end - start + 1
|
val byteReadOffset = if (contentType == "video/webm" && end == 8192L) 0 else 1;
|
||||||
|
val contentLength = end - start + byteReadOffset
|
||||||
responseHeaders["Content-Length"] = contentLength.toString()
|
responseHeaders["Content-Length"] = contentLength.toString()
|
||||||
Logger.i(TAG, "Sending $contentLength bytes (start: $start, end: $end)")
|
Logger.i(TAG, "Sending $contentLength bytes (start: $start, end: $end)")
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ class HttpFileHandler(method: String, path: String, private val contentType: Str
|
|||||||
|
|
||||||
val outputStream = responseStream
|
val outputStream = responseStream
|
||||||
while (true) {
|
while (true) {
|
||||||
val expectedBytesRead = (end - current + 1).coerceAtMost(buffer.size.toLong());
|
val expectedBytesRead = (end - current + byteReadOffset).coerceAtMost(buffer.size.toLong());
|
||||||
val bytesRead = inputStream.read(buffer);
|
val bytesRead = inputStream.read(buffer);
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
Logger.i(TAG, "End of file reached")
|
Logger.i(TAG, "End of file reached")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user