[pitivi] pipeline: Add a watchdog element to the pipeline



commit 5e2025ed15df0978ef55b3ff61c3ca15f183e495
Author: Thibault Saunier <tsaunier gnome org>
Date:   Wed Nov 26 14:40:11 2014 +0100

    pipeline: Add a watchdog element to the pipeline
    
    Right before each sink, we add a watchdog element that
    will make sure the pipeline is not frozen for no good
    reason and post a message on the bus if is the case.
    
    That ERROR message will trigger our recovery code.

 pitivi/check.py          |    3 +++
 pitivi/utils/pipeline.py |   10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/check.py b/pitivi/check.py
index b145231..5c0305a 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -299,4 +299,7 @@ SOFT_DEPENDENCIES = \
         GIDependency("GnomeDesktop", None, _("file thumbnails provided by GNOME's thumbnailers")),
         GIDependency("Notify", None, _("enables visual notifications when rendering is complete")),
         GstPluginDependency("libav", None, _("additional multimedia codecs through the GStreamer Libav 
library")),
+        GstPluginDependency("debugutilsbad", None, _("enables a watchdog in the GStreamer pipeline."
+                                                     " Use to detect errors happening in GStreamer"
+                                                     " and recover from them")),
     )
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index b0714f9..04ba70a 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -45,6 +45,7 @@ PIPELINE_SIGNALS = {
 }
 
 MAX_RECOVERIES = 3
+WATCHDOG_TIMEOUT = 3
 MAX_BRINGING_TO_PAUSED_DURATION = 5
 MAX_SET_STATE_DURATION = 1
 
@@ -396,7 +397,7 @@ class SimplePipeline(GObject.Object, Loggable):
             GLib.source_remove(self._timeout_async_id)
         self._timeout_async_id = 0
 
-    def _addWaitingForAsyncDoneTimeout(self, timeout=3):
+    def _addWaitingForAsyncDoneTimeout(self, timeout=WATCHDOG_TIMEOUT):
         self._removeWaitingForAsyncDoneTimeout()
 
         self._timeout_async_id = GLib.timeout_add_seconds(timeout,
@@ -575,6 +576,13 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         self._seeker = Seeker()
         self._seeker.connect("seek", self._seekCb)
         self._seeker.connect("seek-relative", self._seekRelativeCb)
+        watchdog = Gst.ElementFactory.make("watchdog", None)
+        if watchdog:
+            watchdog.props.timeout = WATCHDOG_TIMEOUT * 1000
+            self.props.video_filter = watchdog
+            watchdog = Gst.ElementFactory.make("watchdog", None)
+            watchdog.props.timeout = WATCHDOG_TIMEOUT * 1000
+            self.props.audio_filter = watchdog
 
     def _getDuration(self):
         return self._timeline.get_duration()


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