]> git.0d.be Git - empathy.git/commitdiff
empathy_call_window_reset_pipeline: start the new pipeline right away
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 17 Feb 2010 12:57:05 +0000 (12:57 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 1 Apr 2010 08:15:39 +0000 (10:15 +0200)
This will allow us to display the video preview before the call is restarted.

src/empathy-call-window.c

index a1ada3eff695f2548690925bcb4c50fa9dabe1b5..ee0a74d5e2e2ee66c448ff74d9e46f9076b9c190 100644 (file)
@@ -197,6 +197,9 @@ struct _EmpathyCallWindowPriv
   gboolean sidebar_was_visible_before_fs;
   gint original_width_before_fs;
   gint original_height_before_fs;
+
+  /* TRUE if the call should be started when the pipeline is playing */
+  gboolean start_call_when_playing;
 };
 
 #define GET_PRIV(o) \
@@ -1056,6 +1059,9 @@ empathy_call_window_init (EmpathyCallWindow *self)
   priv->fsnotifier = fs_element_added_notifier_new ();
   fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (priv->pipeline));
 
+  /* The call will be started as soon the pipeline is playing */
+  priv->start_call_when_playing = TRUE;
+
   keyfile = g_key_file_new ();
   filename = empathy_file_lookup ("element-properties", "data");
   if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
@@ -1545,6 +1551,9 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self)
       priv->funnel = NULL;
 
       create_pipeline (self);
+      /* Call will be started when user will hit the 'redial' button */
+      priv->start_call_when_playing = FALSE;
+      gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
 
       return TRUE;
     }
@@ -2318,7 +2327,6 @@ start_call (EmpathyCallWindow *self)
 
   priv->call_started = TRUE;
   empathy_call_handler_start_call (priv->handler);
-  gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
 
   if (empathy_call_handler_has_initial_video (priv->handler))
     {
@@ -2353,7 +2361,10 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message,
             gst_message_parse_state_changed (message, NULL, &newstate, NULL);
             if (newstate == GST_STATE_PAUSED)
               {
-                start_call (self);
+                gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
+
+                if (priv->start_call_when_playing)
+                  start_call (self);
               }
           }
         break;