[empathy] stop sending video when 'camera off' or 'preview' is enabled



commit 76a44dbf5a997548cc5e2377041d5081369a4c8a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Nov 24 16:58:43 2009 +0000

    stop sending video when 'camera off' or 'preview' is enabled

 src/empathy-call-window.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index eda10f1..02509a5 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -740,8 +740,8 @@ disable_camera (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
-  priv->camera_state = CAMERA_STATE_OFF;
   display_video_preview (self, FALSE);
+  empathy_call_window_set_send_video (self, FALSE);
 
   block_camera_control_signals (self);
   gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
@@ -749,6 +749,8 @@ disable_camera (EmpathyCallWindow *self)
   gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
       priv->tool_button_camera_preview), FALSE);
   unblock_camera_control_signals (self);
+
+  priv->camera_state = CAMERA_STATE_OFF;
 }
 
 static void
@@ -782,7 +784,10 @@ enable_preview (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
-  priv->camera_state = CAMERA_STATE_PREVIEW;
+  if (priv->camera_state == CAMERA_STATE_ON)
+    /* preview is already displayed so we just have to stop sending */
+    empathy_call_window_set_send_video (self, FALSE);
+
   display_video_preview (self, TRUE);
 
   block_camera_control_signals (self);
@@ -791,6 +796,8 @@ enable_preview (EmpathyCallWindow *self)
   gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
         priv->tool_button_camera_on), FALSE);
   unblock_camera_control_signals (self);
+
+  priv->camera_state = CAMERA_STATE_PREVIEW;
 }
 
 static void
@@ -824,7 +831,6 @@ enable_camera (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
-  priv->camera_state = CAMERA_STATE_ON;
   empathy_call_window_set_send_video (self, TRUE);
 
   block_camera_control_signals (self);
@@ -833,6 +839,8 @@ enable_camera (EmpathyCallWindow *self)
   gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
         priv->tool_button_camera_preview), FALSE);
   unblock_camera_control_signals (self);
+
+  priv->camera_state = CAMERA_STATE_ON;
 }
 
 static void



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