diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-06-07 17:06:05 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-06-07 17:49:19 +0800 |
commit | f57e122a8c74452214cfcfcab1cfaa669d8c9e9e (patch) | |
tree | 03ba0032188f964c3767732a721266ba764106d2 /src | |
parent | b6800e4915dba910dae84f0bedc76c6dbde318ce (diff) | |
download | gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar.gz gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar.bz2 gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar.lz gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar.xz gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.tar.zst gsoc2013-empathy-f57e122a8c74452214cfcfcab1cfaa669d8c9e9e.zip |
empathy_call_window_set_send_video: only disable preview if we need to
There is no point to stop the camera if we're about to restart it right after
because "preview only" is enabled.
Furthermore that causes weird races making the video jumps out of the window
(#62076).
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 40c461488..5fd232bc6 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -224,7 +224,7 @@ static void empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, EmpathyCallWindow *window); static void empathy_call_window_set_send_video (EmpathyCallWindow *window, - gboolean send); + CameraState state); static void empathy_call_window_mic_toggled_cb ( GtkToggleToolButton *toggle, EmpathyCallWindow *window); @@ -810,7 +810,7 @@ disable_camera (EmpathyCallWindow *self) display_video_preview (self, FALSE); if (priv->camera_state == CAMERA_STATE_ON) - empathy_call_window_set_send_video (self, FALSE); + empathy_call_window_set_send_video (self, CAMERA_STATE_OFF); block_camera_control_signals (self); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( @@ -860,10 +860,14 @@ enable_preview (EmpathyCallWindow *self) DEBUG ("Enable 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); + { + /* preview is already displayed so we just have to stop sending */ + empathy_call_window_set_send_video (self, CAMERA_STATE_PREVIEW); + } + else + { + display_video_preview (self, TRUE); + } block_camera_control_signals (self); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( @@ -919,7 +923,7 @@ enable_camera (EmpathyCallWindow *self) DEBUG ("Enable camera"); - empathy_call_window_set_send_video (self, TRUE); + empathy_call_window_set_send_video (self, CAMERA_STATE_ON); block_camera_control_signals (self); gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( @@ -2175,7 +2179,7 @@ empathy_call_window_connected (gpointer user_data) gtk_widget_set_sensitive (priv->dtmf_panel, TRUE); if (priv->video_input == NULL) - empathy_call_window_set_send_video (self, FALSE); + empathy_call_window_set_send_video (self, CAMERA_STATE_OFF); priv->sending_video = can_send_video ? empathy_tp_call_is_sending_video (call) : FALSE; @@ -2717,23 +2721,31 @@ empathy_call_window_sidebar_toggled_cb (GtkToggleButton *toggle, static void empathy_call_window_set_send_video (EmpathyCallWindow *window, - gboolean send) + CameraState state) { EmpathyCallWindowPriv *priv = GET_PRIV (window); EmpathyTpCall *call; - priv->sending_video = send; + priv->sending_video = (state == CAMERA_STATE_ON); - /* When we start sending video, we want to show the video preview by - default. */ - display_video_preview (window, send); + if (state == CAMERA_STATE_PREVIEW || + state == CAMERA_STATE_ON) + { + /* When we start sending video, we want to show the video preview by + default. */ + display_video_preview (window, TRUE); + } + else + { + display_video_preview (window, FALSE); + } if (priv->call_state != CONNECTED) return; g_object_get (priv->handler, "tp-call", &call, NULL); - DEBUG ("%s sending video", send ? "start": "stop"); - empathy_tp_call_request_video_stream_direction (call, send); + DEBUG ("%s sending video", priv->sending_video ? "start": "stop"); + empathy_tp_call_request_video_stream_direction (call, priv->sending_video); g_object_unref (call); } |