gstreamer: reduce lock time when _update()

This commit is contained in:
Mathieu Virbel 2012-12-04 16:54:15 +01:00
parent dfb8987270
commit 32c14702c3
1 changed files with 6 additions and 4 deletions

View File

@ -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)