[pitivi] previewers: Fix usage of GstCPUThrottle clock
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] previewers: Fix usage of GstCPUThrottle clock
- Date: Fri, 14 Jul 2017 04:32:42 +0000 (UTC)
commit 4af299a26f9a46e44a610741117278d2b3f3ae51
Author: Thibault Saunier <tsaunier gnome org>
Date: Thu Jul 13 23:01:13 2017 -0400
previewers: Fix usage of GstCPUThrottle clock
The throttle clock should simply be used from the start and the pipeline
and we let it do its job.
And make sure to cleanup the pipeline once the waveform file is ready
Fixes T7777
pitivi/timeline/previewers.py | 31 ++++++++-----------------------
1 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 926bcf5..9915f33 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -926,6 +926,12 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
self.pipeline = Gst.parse_launch("uridecodebin name=decode uri=" +
self._uri + " ! waveformbin name=wave"
" ! fakesink qos=false name=faked")
+ # This line is necessary so we can instantiate GstTranscoder's
+ # GstCpuThrottlingClock below.
+ Gst.ElementFactory.make("uritranscodebin", None)
+ clock = GObject.new(GObject.type_from_name("GstCpuThrottlingClock"))
+ clock.props.cpu_usage = self.app.settings.previewers_max_cpu
+ self.pipeline.use_clock(clock)
faked = self.pipeline.get_by_name("faked")
faked.props.sync = True
self._wavebin = self.pipeline.get_by_name("wave")
@@ -984,28 +990,6 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
self.error("Aborting due to waveforms generation issue: %s",
message.parse_error())
- elif message.type == Gst.MessageType.STATE_CHANGED:
- prev, new, unused_pending_state = message.parse_state_changed()
- if message.src == self.pipeline:
- if prev == Gst.State.READY and new == Gst.State.PAUSED:
- self.pipeline.seek(1.0,
- Gst.Format.TIME,
- Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE,
- Gst.SeekType.SET,
- 0,
- Gst.SeekType.NONE,
- -1)
-
- # In case we failed previously, we won't modulate next time
- elif not self.adapter and prev == Gst.State.PAUSED and \
- new == Gst.State.PLAYING and self._num_failures == 0:
- # This line is necessary so we can instantiate GstTranscoder's
- # GstCpuThrottlingClock below.
- Gst.ElementFactory.make("uritranscodebin", None)
- clock = GObject.new(GObject.type_from_name("GstCpuThrottlingClock"))
- clock.props.cpu_usage = self.app.settings.previewers_max_cpu
- self.pipeline.use_clock(clock)
-
# pylint: disable=no-self-use
def _autoplug_select_cb(self, unused_decode, unused_pad, unused_caps, factory):
# Don't plug video decoders / parsers.
@@ -1064,7 +1048,8 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
if self.pipeline:
self.pipeline.set_state(Gst.State.NULL)
- self.pipeline.get_state(Gst.CLOCK_TIME_NONE)
+ self.pipeline.get_bus().disconnect_by_func(self._busMessageCb)
+ self.pipeline = None
self.emit("done")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]