[Android] Avoid audio notification desync when speed or chapter change

Nicolas Pomepuy git at videolan.org
Tue Aug 10 10:22:01 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Aug 10 07:48:17 2021 +0200| [4eb4d06d6dcaea6682d1a614ed831faa03a1b92a] | committer: Nicolas Pomepuy

Avoid audio notification desync when speed or chapter change

Fixes #2135
Fixes #2136

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

 .../vlc-android/src/org/videolan/vlc/PlaybackService.kt      | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 28bf904ee..8e2472905 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -443,7 +443,12 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
         @MainThread
         get() = playlistManager.player.getChapterIdx()
         @MainThread
-        set(chapter) = playlistManager.player.setChapterIdx(chapter)
+        set(chapter) {
+            playlistManager.player.setChapterIdx(chapter)
+            getChapters(-1)?.let {
+                publishState(it[chapter].timeOffset)
+            }
+        }
 
     var titleIdx: Int
         @MainThread
@@ -1395,7 +1400,10 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner {
     }
 
     @MainThread
-    fun setRate(rate: Float, save: Boolean) = playlistManager.player.setRate(rate, save)
+    fun setRate(rate: Float, save: Boolean) {
+        playlistManager.player.setRate(rate, save)
+        publishState()
+    }
 
     @MainThread
     fun navigate(where: Int) = playlistManager.player.navigate(where)



More information about the Android mailing list