[pitivi] previewers: Remove double initial scheduling
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] previewers: Remove double initial scheduling
- Date: Fri, 9 Feb 2018 06:54:49 +0000 (UTC)
commit c0160a6f6d4d39fc2907767cd5701cb97c89952e
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Jan 15 22:58:17 2018 +0100
previewers: Remove double initial scheduling
_schedule_next_thumb_generation was being called twice, causing two
timeouts to be created:
- from _start_thumbnailing_cb,
- from __bus_message_cb because the pipeline has been PAUSED.
Now we only schedule when the pipeline has been PAUSED.
Additionally, we create the pipeline only if needed, to avoid waiting
for no reason.
Differential Revision: https://phabricator.freedesktop.org/D1939
pitivi/timeline/previewers.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 949d4fb..9cadca6 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -495,6 +495,10 @@ class VideoPreviewer(Previewer, Zoomable, Loggable):
thumbnail will be generated +/- 10%. Even then, it will only
happen when the gobject loop is idle to avoid blocking the UI.
"""
+ if self._thumb_cb_id is not None:
+ # A thumb has already been scheduled.
+ return
+
if not self.queue:
# Nothing left to do.
self.debug("Thumbnails generation complete")
@@ -525,18 +529,22 @@ class VideoPreviewer(Previewer, Zoomable, Loggable):
self.__start_id = None
if isinstance(self.ges_elem, GES.ImageSource):
- self.debug('Now generating thumbnail for: %s', path_from_uri(self.uri))
+ self.debug("Generating thumbnail for image: %s", path_from_uri(self.uri))
self.__image_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
Gst.uri_get_location(self.uri), -1, self.thumb_height, True)
self.thumb_width = self.__image_pixbuf.props.width
self._update_thumbnails()
self.emit("done")
else:
- self.debug('Now generating thumbnails for: %s', path_from_uri(self.uri))
- self.pipeline = self._setup_pipeline()
# Update the thumbnails with what we already have, if anything.
self._update_thumbnails()
- self._schedule_next_thumb_generation()
+ if self.queue:
+ self.debug("Generating thumbnails for video: %s, %s", path_from_uri(self.uri), self.queue)
+ # When the pipeline status is set to PAUSED,
+ # the first thumbnail generation will be scheduled.
+ self.pipeline = self._setup_pipeline()
+ else:
+ self.emit("done")
def _create_next_thumb_cb(self):
"""Creates a missing thumbnail."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]