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



commit d4a704c5700d603cb20699b9872203c551e9e305
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 23b3ac7c..a27480ee 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -297,10 +297,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]