Commit 9f06ab5d authored by Alexandru Băluț's avatar Alexandru Băluț

pipeline: Declare pipeline dead only once

The pipeline was being declared dead first when an error was reported on
the bus, and second when the async-done was not being received.

Fixes #2232
parent cfa489d2
Pipeline #27115 passed with stages
in 78 minutes and 38 seconds
......@@ -422,9 +422,10 @@ class SimplePipeline(GObject.Object, Loggable):
Gst.DebugGraphDetails.ALL,
"pitivi.error")
if not self._rendering():
self._removeWaitingForAsyncDoneTimeout()
self._recover()
elif message.type == Gst.MessageType.DURATION_CHANGED:
self.debug("Duration might have changed, querying it")
self.debug("Querying duration async, because it changed")
GLib.idle_add(self._queryDurationAsync)
elif message.type == Gst.MessageType.ASYNC_DONE:
self.debug("Async done, ready for action")
......@@ -459,21 +460,19 @@ class SimplePipeline(GObject.Object, Loggable):
def _recover(self):
if not self._bus:
raise PipelineError("Should not try to recover after destroy")
if self._attempted_recoveries == MAX_RECOVERIES:
self.emit("died")
self.error(
"Pipeline error detected multiple times in a row, not resetting anymore")
self.error("Declaring pipeline dead, because %d successive reset attempts failed", MAX_RECOVERIES)
return
self.error("Pipeline error detected during playback, resetting"
" -- num tries: %d", self._attempted_recoveries)
self._attempted_recoveries += 1
self.error("Resetting pipeline because error detected during playback. "
"Try %d", self._attempted_recoveries)
self.setState(Gst.State.NULL)
self._recovery_state = self.RecoveryState.STARTED_RECOVERING
self.pause()
self._attempted_recoveries += 1
def _queryDurationAsync(self, *unused_args, **unused_kwargs):
try:
self.getDuration()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment