File tree 2 files changed +19
-0
lines changed
lib/src/main/java/com/otaliastudios/transcoder/internal
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,18 @@ class CustomSegments(
52
52
}
53
53
}
54
54
55
+ fun releaseSegment (id : String ) {
56
+ val segment = segmentMap[id]
57
+ segment?.let {
58
+ it.release()
59
+ val source = sources[it.type][it.index]
60
+ if (tracks.active.has(it.type)) {
61
+ source.releaseTrack(it.type)
62
+ }
63
+ segmentMap[id] = null
64
+ }
65
+ }
66
+
55
67
fun release () = destroySegment(true )
56
68
57
69
private fun tryCreateSegment (id : String ): Segment ? {
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ class DefaultThumbnailsEngine(
233
233
}
234
234
235
235
override fun removeDataSource (dataSourceId : String ) {
236
+ segments.releaseSegment(dataSourceId)
236
237
dataSources.removeVideoDataSource(dataSourceId)
237
238
tracks.updateTracksInfo()
238
239
}
@@ -285,6 +286,11 @@ class DefaultThumbnailsEngine(
285
286
}
286
287
287
288
override suspend fun removePosition (source : String , positionUs : Long ) {
289
+ if (positionUs < 0 ) {
290
+ stubs.removeAll{
291
+ it.request.sourceId() == source
292
+ }
293
+ }
288
294
if (stubs.firstOrNull()?.request?.sourceId() == source && positionUs == stubs.firstOrNull()?.positionUs) {
289
295
return
290
296
}
@@ -320,6 +326,7 @@ class DefaultThumbnailsEngine(
320
326
}
321
327
322
328
override fun cleanup () {
329
+ runCatching { stubs.clear() }
323
330
runCatching { segments.release() }
324
331
runCatching { dataSources.release() }
325
332
}
You can’t perform that action at this time.
0 commit comments