From 32c14702c3062b60a8755315455031c73b217413 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Tue, 4 Dec 2012 16:54:15 +0100 Subject: [PATCH] gstreamer: reduce lock time when _update() --- kivy/core/video/video_gstreamer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kivy/core/video/video_gstreamer.py b/kivy/core/video/video_gstreamer.py index b5bd038c6..f332eeaed 100644 --- a/kivy/core/video/video_gstreamer.py +++ b/kivy/core/video/video_gstreamer.py @@ -108,11 +108,13 @@ class VideoGStreamer(VideoBase): self._texture.blit_buffer(buf.data, size=size, colorfmt='rgb') def _update(self, dt): + buf = None with self._buffer_lock: - if self._buffer is not None: - self._update_texture(self._buffer) - self._buffer = None - self.dispatch('on_frame') + buf = self._buffer + self._buffer = None + if buf is not None: + self._update_texture(buf) + self.dispatch('on_frame') def unload(self): self._playbin.set_state(gst.STATE_NULL)