[Android] Fix race condition while sending the sleep timer value to the remote access

Nicolas Pomepuy git at videolan.org
Mon Sep 9 15:14:15 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep  9 14:05:14 2024 +0200| [c0d0cfcb27954cfcc1e5a0d3cd7ca2864718a1ec] | committer: Duncan McNamara

Fix race condition while sending the sleep timer value to the remote access

> https://code.videolan.org/videolan/vlc-android/commit/c0d0cfcb27954cfcc1e5a0d3cd7ca2864718a1ec
---

 .../src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt
index e6f160f04c..c9ce294d3f 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessServer.kt
@@ -588,7 +588,7 @@ class RemoteAccessServer(private val context: Context) : PlaybackService.Callbac
                 val chapters = withContext(Dispatchers.IO) { service.getChapters(-1) ?: arrayOf() }
                 val speed = String.format(Locale.US, "%.2f", service.speed).toFloat()
                 var sleepTimer = 0L
-                scope.launch(Dispatchers.Main) {
+                withContext(Dispatchers.Main) {
                     sleepTimer = playerSleepTime.value?.time?.time ?: 0L
                 }
                 val waitForMediaEnd = service.waitForMediaEnd



More information about the Android mailing list