From 9fa464474cadc0ab088a3ae4c6a05bbd5a1a9d95 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 22 Aug 2012 19:47:25 +0000 Subject: Update time and state on seek When the horizontal scroll changes its value it updates the time position (label) to know where are we going to drop the stream. The state of the stream[1] is updated with a timeout of 1ns, so it doesn't consume too much CPU. This impacts directily the performance on seeking videos and audios. [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-get-state Signed-off-by: Manuel Kaufmann --- diff --git a/jukeboxactivity.py b/jukeboxactivity.py index aebbc98..5951b01 100644 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -558,11 +558,6 @@ class JukeboxActivity(activity.Activity): if self.was_playing: self.player.pause() - # don't timeout-update position during seek - if self.update_id != -1: - GObject.source_remove(self.update_id) - self.update_id = -1 - # make sure we get changed notifies if self.changed_id == -1: self.changed_id = self.control.hscale.connect('value-changed', @@ -573,7 +568,7 @@ class JukeboxActivity(activity.Activity): real = long(scale.get_value() * self.p_duration / 100) # in ns self.player.seek(real) # allow for a preroll - self.player.get_state(timeout=50 * gst.MSECOND) # 50 ms + self.player.get_state() # timeout = 1 ns def scale_button_release_cb(self, widget, event): # see seek.cstop_seek @@ -589,7 +584,8 @@ class JukeboxActivity(activity.Activity): self.player.play() if self.update_id != -1: - self.error('Had a previous update timeout id') + GObject.source_remove(self.seek_timeout_id) + self.update_id = -1 else: self.update_id = GObject.timeout_add(self.UPDATE_INTERVAL, self.update_scale_cb) -- cgit v0.9.1