Fixed not closed connection in CachedDataSource

This commit is contained in:
Nite 2022-05-06 18:51:12 +02:00
parent 926081f84c
commit faf07f2887
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
1 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,7 @@ import timber.log.Timber
@androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class)
class CachedDataSource(
private var upstreamDataSource: DataSource
) : BaseDataSource(false) {
) : BaseDataSource(true) {
class Factory(
private var upstreamDataSourceFactory: DataSource.Factory
@ -186,6 +186,8 @@ class CachedDataSource(
transferEnded()
responseByteStream?.close()
responseByteStream = null
} else {
upstreamDataSource.close()
}
}