File tree Expand file tree Collapse file tree
app/src/main/java/com/lastwave/app/data/download Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import java.io.ByteArrayOutputStream
55import java.io.File
66import java.io.FileInputStream
77import java.io.FileOutputStream
8+ import java.io.InputStream
9+ import java.io.OutputStream
810import java.io.RandomAccessFile
911
1012/* *
@@ -676,7 +678,7 @@ object Fmp4IndexBuilder {
676678 return out .toByteArray()
677679 }
678680
679- private fun copyExactly (input : FileInputStream , output : FileOutputStream , count : Long ) {
681+ private fun copyExactly (input : InputStream , output : OutputStream , count : Long ) {
680682 var remaining = count
681683 val buffer = ByteArray (COPY_BUFFER_SIZE )
682684 while (remaining > 0L ) {
@@ -688,7 +690,7 @@ object Fmp4IndexBuilder {
688690 }
689691 }
690692
691- private fun copyStream (input : FileInputStream , output : FileOutputStream ) {
693+ private fun copyStream (input : InputStream , output : OutputStream ) {
692694 val buffer = ByteArray (COPY_BUFFER_SIZE )
693695 while (true ) {
694696 val read = input.read(buffer)
Original file line number Diff line number Diff line change @@ -1329,9 +1329,7 @@ class TrackDownloadManager @Inject constructor(
13291329 expectedContentLength = ytStream.contentLength
13301330 ? : runCatching { Uri .parse(ytStream.url).getQueryParameter(" clen" )?.toLongOrNull() }.getOrNull()
13311331 if (durationMs <= 0L ) {
1332- val candidateMs = chosenTrack?.durationMs
1333- ? : preloadedBestMatch?.durationMs
1334- ? : pickedStream?.duration?.times(1000L )
1332+ val candidateMs = pickedStream?.durationMs
13351333 ? : (chosenTrack?.durationSeconds?.takeIf { it > 0 }?.times(1000L ))
13361334 ? : (preloadedBestMatch?.durationSeconds?.takeIf { it > 0 }?.times(1000L ))
13371335 if (candidateMs != null && candidateMs > 0L ) {
You can’t perform that action at this time.
0 commit comments