aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-call-window.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-06-13 19:07:31 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-25 19:47:24 +0800
commit2a84ffe088258126169ae7d91806d32cab199286 (patch)
tree41b6a0999d8f8aef293b820ee7f9231ed0d2c6e2 /src/empathy-call-window.c
parentd9bb5b999731c247b845ba7e97393d2e25bcfeca (diff)
downloadgsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar.gz
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar.bz2
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar.lz
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar.xz
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.tar.zst
gsoc2013-empathy-2a84ffe088258126169ae7d91806d32cab199286.zip
CallWindow: show the remote avatar when video stops coming
If we don't get incoming video for a few seconds, show the remote contact avatar instead of the frozen video, and show the video back if it starts coming again.
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r--src/empathy-call-window.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 97106be12..59e833881 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -199,6 +199,9 @@ struct _EmpathyCallWindowPriv
EmpathyCallWindowFullscreen *fullscreen;
gboolean is_fullscreen;
+ gboolean got_video;
+ guint got_video_src;
+
/* Those fields represent the state of the window before it actually was in
fullscreen mode. */
gboolean sidebar_was_visible_before_fs;
@@ -590,6 +593,16 @@ empathy_call_window_create_audio_input (EmpathyCallWindow *self)
}
static void
+empathy_call_window_show_video_output (EmpathyCallWindow *self,
+ gboolean show)
+{
+ if (self->priv->video_output != NULL)
+ g_object_set (self->priv->video_output, "visible", show, NULL);
+
+ gtk_widget_set_visible (self->priv->remote_user_avatar_widget, !show);
+}
+
+static void
create_video_output_widget (EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
@@ -1634,6 +1647,12 @@ empathy_call_window_dispose (GObject *object)
priv->bus_message_source_id = 0;
}
+ if (priv->got_video_src > 0)
+ {
+ g_source_remove (priv->got_video_src);
+ priv->got_video_src = 0;
+ }
+
tp_clear_object (&priv->pipeline);
tp_clear_object (&priv->video_input);
tp_clear_object (&priv->audio_input);
@@ -1869,6 +1888,11 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
if (priv->video_output != NULL)
clutter_actor_destroy (priv->video_output);
priv->video_output = NULL;
+ if (priv->got_video_src > 0)
+ {
+ g_source_remove (priv->got_video_src);
+ priv->got_video_src = 0;
+ }
gtk_widget_show (priv->remote_user_avatar_widget);
@@ -2358,6 +2382,42 @@ emapthy_call_window_show_video_output_cb (gpointer user_data)
return FALSE;
}
+static gboolean
+empathy_call_window_check_video_cb (gpointer data)
+{
+ EmpathyCallWindow *self = data;
+
+ if (self->priv->got_video)
+ {
+ self->priv->got_video = FALSE;
+ return TRUE;
+ }
+
+ /* No video in the last N seconds, display the remote avatar */
+ empathy_call_window_show_video_output (self, FALSE);
+
+ return TRUE;
+}
+
+/* Called from the streaming thread */
+static gboolean
+empathy_call_window_video_probe_cb (GstPad *pad,
+ GstMiniObject *mini_obj,
+ EmpathyCallWindow *self)
+{
+ if (G_UNLIKELY (!self->priv->got_video))
+ {
+ /* show the remote video */
+ g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+ emapthy_call_window_show_video_output_cb,
+ g_object_ref (self), g_object_unref);
+
+ self->priv->got_video = TRUE;
+ }
+
+ return TRUE;
+}
+
/* Called from the streaming thread */
static gboolean
empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
@@ -2379,6 +2439,13 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
case TP_MEDIA_STREAM_TYPE_VIDEO:
g_idle_add (emapthy_call_window_show_video_output_cb, self);
pad = empathy_call_window_get_video_sink_pad (self);
+
+ gst_pad_add_data_probe (src,
+ G_CALLBACK (empathy_call_window_video_probe_cb), self);
+ if (priv->got_video_src > 0)
+ g_source_remove (priv->got_video_src);
+ priv->got_video_src = g_timeout_add_seconds (5,
+ empathy_call_window_check_video_cb, self);
break;
default:
g_assert_not_reached ();