[pitivi] pipeline: Avoid seeking when the state is NULL



commit 52b390422ecc19edc58f824ca39285a0c8306037
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Apr 11 23:29:22 2017 +0200

    pipeline: Avoid seeking when the state is NULL
    
    Seeking when the state is NULL should be a NOOP.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1721

 pitivi/utils/pipeline.py |    2 +-
 pitivi/viewer/viewer.py  |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index b41f26a..d1676ef 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -340,7 +340,7 @@ class SimplePipeline(GObject.Object, Loggable):
         Raises:
             PipelineError: When the seek fails.
         """
-        if self._busy_async:
+        if self._busy_async or self.getState() < Gst.State.PAUSED:
             self._next_seek = position
             self.info("Setting next seek to %s", self._next_seek)
             return
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 6561a8a..4d3968a 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -119,9 +119,6 @@ class ViewerContainer(Gtk.Box, Loggable):
                 parent.remove(self.target)
 
         self.pipeline = pipeline
-        if position:
-            self.pipeline.simple_seek(position)
-
         self.pipeline.connect("state-change", self._pipelineStateChangedCb)
         self.pipeline.connect("position", self._positionCb)
         self.pipeline.connect("duration-changed", self._durationChangedCb)
@@ -130,6 +127,8 @@ class ViewerContainer(Gtk.Box, Loggable):
         self.__createNewViewer()
         self._setUiActive()
 
+        if position:
+            self.pipeline.simple_seek(position)
         self.pipeline.pause()
 
     def __createNewViewer(self):


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