[gnome-music/wip/mschraal/gapless-v3: 2/5] gstplayer: Do not seek to exact end



commit dafd04bc79ba412187cb3e6ff4008d56a3dd51dd
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat May 4 13:55:05 2019 +0200

    gstplayer: Do not seek to exact end
    
    Seeking to the exact end of a song in combination with gapless playback
    triggers a stream error.
    Make sure to never seek to the exact endpoint of a stream.

 gnomemusic/gstplayer.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index b60e84e9..5ebebf48 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -315,10 +315,13 @@ class GstPlayer(GObject.GObject):
 
         :param float seconds: Position in seconds to seek
         """
+        if seconds > 0:
+            seconds = (seconds * Gst.SECOND) - 1
+
         # FIXME: seek should be signalled to MPRIS
         self._player.seek_simple(
             Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT,
-            seconds * Gst.SECOND)
+            seconds)
 
     @log
     def _start_plugin_installation(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]