[Telepathy-commits] [telepathy-gabble/master] GabbleJingleContent: don't update content senders if they haven't changed

Senko Rasic senko.rasic at collabora.co.uk
Tue Dec 2 04:34:09 PST 2008


---
 src/jingle-content.c |   15 ++++++++++-----
 src/media-stream.c   |    6 +-----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/jingle-content.c b/src/jingle-content.c
index cc83ab8..4071bfc 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -580,6 +580,7 @@ gabble_jingle_content_parse_accept (GabbleJingleContent *c,
   const gchar *senders;
   LmMessageNode *trans_node, *desc_node;
   JingleDialect dialect;
+  JingleContentSenders newsenders;
 
   desc_node = lm_message_node_get_child_any_ns (content_node, "description");
   trans_node = lm_message_node_get_child_any_ns (content_node, "transport");
@@ -601,20 +602,24 @@ gabble_jingle_content_parse_accept (GabbleJingleContent *c,
   if (senders == NULL)
       senders = "both";
 
-  DEBUG ("changing senders from %s to %s", produce_senders (priv->senders), senders);
-  priv->senders = parse_senders (senders);
-  if (priv->senders == JINGLE_CONTENT_SENDERS_NONE)
+  newsenders = parse_senders (senders);
+  if (newsenders == JINGLE_CONTENT_SENDERS_NONE)
     {
       SET_BAD_REQ ("invalid content senders");
       return;
     }
 
+  if (newsenders != priv->senders)
+    {
+      DEBUG ("changing senders from %s to %s", produce_senders (priv->senders), senders);
+      priv->senders = newsenders;
+      g_object_notify ((GObject *) c, "senders");
+    }
+
   parse_description (c, desc_node, error);
   if (*error != NULL)
       return;
 
-  g_object_notify ((GObject *) c, "senders");
-
   priv->state = JINGLE_CONTENT_STATE_ACKNOWLEDGED;
   g_object_notify ((GObject *) c, "state");
 }
diff --git a/src/media-stream.c b/src/media-stream.c
index 0b4a86b..f47b06e 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -1497,13 +1497,9 @@ gabble_media_stream_change_direction (GabbleMediaStream *stream,
 static void
 update_sending (GabbleMediaStream *stream, gboolean start_sending)
 {
-  GabbleMediaStreamPrivate *priv;
+  GabbleMediaStreamPrivate *priv = GABBLE_MEDIA_STREAM_GET_PRIVATE (stream);
   gboolean new_sending;
 
-  g_assert (GABBLE_IS_MEDIA_STREAM (stream));
-
-  priv = GABBLE_MEDIA_STREAM_GET_PRIVATE (stream);
-
   new_sending =
     ((stream->combined_direction & TP_MEDIA_STREAM_DIRECTION_SEND) != 0);
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list