[clutter-gst] video-player: set_playing: Don't do anything when not changing state



commit 3ce54eed276a485a4560b32417e9ee9f092cb97e
Author: Damien Lespiau <damien lespiau intel com>
Date:   Wed Mar 30 23:25:59 2011 +0100

    video-player: set_playing: Don't do anything when not changing state
    
    This protects from doing any work with consecutive calls with the same
    playing state.

 clutter-gst/clutter-gst-video-texture.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c
index 7838dc8..f60d34a 100644
--- a/clutter-gst/clutter-gst-video-texture.c
+++ b/clutter-gst/clutter-gst-video-texture.c
@@ -441,13 +441,19 @@ set_playing (ClutterGstVideoTexture *video_texture,
              gboolean                playing)
 {
   ClutterGstVideoTexturePrivate *priv = video_texture->priv;
+  GstState target_state;
 
   if (!priv->pipeline)
     return;
 
   CLUTTER_GST_NOTE (MEDIA, "set playing: %d", playing);
 
-  priv->target_state = playing ? GST_STATE_PLAYING : GST_STATE_PAUSED;
+  /* Don't do anything if we are not actually changing state */
+  target_state = playing ? GST_STATE_PLAYING : GST_STATE_PAUSED;
+  if (target_state == priv->target_state)
+    return;
+
+  priv->target_state = target_state;
 
   if (priv->uri)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]