You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mediaplayer/src/jvmMain/kotlin/io/github/kdroidfilter/composemediaplayer/windows/WindowsVideoPlayerState.kt
+17-3Lines changed: 17 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -355,7 +355,14 @@ class WindowsVideoPlayerState : PlatformVideoPlayerState {
355
355
356
356
// Free bitmaps and frame buffers
357
357
bitmapLock.write {
358
-
_currentFrame?.close()
358
+
val currentFrame =_currentFrame
359
+
if (currentFrame !=null&&
360
+
currentFrame !== skiaBitmapA &&
361
+
currentFrame !== skiaBitmapB &&
362
+
currentFrame !== frameBitmapRecycler
363
+
) {
364
+
currentFrame.close()
365
+
}
359
366
_currentFrame=null
360
367
currentFrameState.value =null
361
368
frameBitmapRecycler?.close()
@@ -404,7 +411,14 @@ class WindowsVideoPlayerState : PlatformVideoPlayerState {
404
411
405
412
// Free bitmaps and frame buffers
406
413
bitmapLock.write {
407
-
_currentFrame?.close() // Close the current frame bitmap if any
414
+
val currentFrame =_currentFrame
415
+
if (currentFrame !=null&&
416
+
currentFrame !== skiaBitmapA &&
417
+
currentFrame !== skiaBitmapB &&
418
+
currentFrame !== frameBitmapRecycler
419
+
) {
420
+
currentFrame.close()
421
+
}
408
422
_currentFrame=null
409
423
// Reset the currentFrameState
410
424
currentFrameState.value =null
@@ -1284,4 +1298,4 @@ class WindowsVideoPlayerState : PlatformVideoPlayerState {
0 commit comments