]> git.0d.be Git - empathy.git/commitdiff
recycle the audio output gst element
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 2 Dec 2009 17:15:27 +0000 (17:15 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 1 Apr 2010 08:15:38 +0000 (10:15 +0200)
There is no point to create a new one for each call.

src/empathy-call-window.c

index 4a630176633cd77916d9a4fb73c8a20c31e021dc..f1d3e7be33b6a1dfc6dcf7a46717778cc235ee42 100644 (file)
@@ -608,7 +608,14 @@ initialize_output_elements (GstBus *bus, EmpathyCallWindow *self)
       GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK);
   g_signal_connect (G_OBJECT (priv->video_output), "button-press-event",
       G_CALLBACK (empathy_call_window_video_button_press_cb), self);
+}
+
+static void
+create_audio_output (EmpathyCallWindow *self)
+{
+  EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
+  g_assert (priv->audio_output == NULL);
   priv->audio_output = empathy_audio_sink_new ();
   gst_object_ref (priv->audio_output);
   gst_object_sink (priv->audio_output);
@@ -1008,6 +1015,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
       priv->self_user_output_hbox);
 
   create_pipeline (self);
+  create_audio_output (self);
 
   priv->fsnotifier = fs_element_added_notifier_new ();
   fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (priv->pipeline));
@@ -1497,10 +1505,6 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self)
       g_signal_handlers_disconnect_by_func (priv->audio_input_adj,
           empathy_call_window_mic_volume_changed_cb, self);
 
-      if (priv->audio_output != NULL)
-        g_object_unref (priv->audio_output);
-      priv->audio_output = NULL;
-
       if (priv->video_tee != NULL)
         g_object_unref (priv->video_tee);
       priv->video_tee = NULL;