Author: dzzinstant
Date: Thu Jul 31 22:57:54 2014
New Revision: 27

URL: http://svn.gna.org/viewcvs/pidgin-zrtp?rev=27&view=rev
Log:
ZrtpChannel: Get rid of useless many:many signaling

Modified:
    trunk/src/pidgin-plugin/simplezrtp/zrtp-call.c
    trunk/src/pidgin-plugin/simplezrtp/zrtp-channel.c

Modified: trunk/src/pidgin-plugin/simplezrtp/zrtp-call.c
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/src/pidgin-plugin/simplezrtp/zrtp-call.c?rev=27&r1=26&r2=27&view=diff
==============================================================================
--- trunk/src/pidgin-plugin/simplezrtp/zrtp-call.c      (original)
+++ trunk/src/pidgin-plugin/simplezrtp/zrtp-call.c      Thu Jul 31 22:57:54 2014
@@ -46,10 +46,9 @@
 
 enum {
        S_ERROR,
-       RELINK_STATE,
        LAST_SIGNAL
 };
-static guint zrtp_call_signals[LAST_SIGNAL] = {0};
+//static guint zrtp_call_signals[LAST_SIGNAL] = {0};
 
 static const char *ZrtpStates[] = {
        "None",
@@ -476,11 +475,6 @@
                                FALSE,
                                G_PARAM_READWRITE));
 
-       zrtp_call_signals[RELINK_STATE] =
-               g_signal_new("relink-state", G_TYPE_FROM_CLASS(klass),
-                               G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-                               g_cclosure_marshal_VOID__UINT_POINTER,
-                               G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER);
 //     zrtp_call_signals[S_ERROR] =
 //             g_signal_new("error", G_TYPE_FROM_CLASS(klass),
 //                             G_SIGNAL_RUN_LAST, 0, NULL, NULL,

Modified: trunk/src/pidgin-plugin/simplezrtp/zrtp-channel.c
URL: 
http://svn.gna.org/viewcvs/pidgin-zrtp/trunk/src/pidgin-plugin/simplezrtp/zrtp-channel.c?rev=27&r1=26&r2=27&view=diff
==============================================================================
--- trunk/src/pidgin-plugin/simplezrtp/zrtp-channel.c   (original)
+++ trunk/src/pidgin-plugin/simplezrtp/zrtp-channel.c   Thu Jul 31 22:57:54 2014
@@ -95,42 +95,25 @@
 }
 
 static void
-relink_state_cb(ZrtpCall *call, guint state, gpointer chptr, gpointer data)
-{
-       ZrtpChannel *ch = (ZrtpChannel *) chptr;
-       if (chptr != data) /* TODO: ZrtpChannel should have its own signals */
-               return;
-
-//     g_debug("relink_state: channel=%p (sid=%u), linkedflags=0x%02x", 
-//                     ch, ch->sid, ch->linkedflags);
+relink_state(ZrtpChannel *ch)
+{
+       g_debug("relink_state: channel=%p (sid=%u), linkedflags=0x%02x", 
+                       ch, ch->sid, ch->linkedflags);
+
+       DEBUG_ZRTPCHANNEL(ch, "thread=%p", g_thread_self());
        if (ZRTP_LINKED_ALL == ch->linkedflags) {
                DEBUG_ZRTPCHANNEL(ch, "relink_state_cb: sid=%u", ch->sid);
 
-               gst_element_sync_state_with_parent(ch->zrtpfilter);
+               
g_warn_if_fail(gst_element_sync_state_with_parent(ch->zrtpfilter));
                zrtp_call_configure_filter(ZRTP_CALL(ch->call), ch->zrtpfilter);
        }
        else if (ZRTP_LINKED_NONE == ch->linkedflags) {
                GstElement *el = ch->zrtpfilter;
                GstObject *bin = gst_element_get_parent(el);
 
-               gst_bin_remove(GST_BIN(bin), el);
+               g_warn_if_fail(gst_bin_remove(GST_BIN(bin), el));
                gst_object_unref(bin);
        }
-}
-
-static void
-connect_call(ZrtpChannel *ch)
-{
-       g_signal_connect(G_OBJECT(ch->call), 
-                       "relink-state", G_CALLBACK(relink_state_cb), ch);
-}
-
-static void
-disconnect_call(ZrtpChannel *ch)
-{
-       g_signal_handlers_disconnect_matched(G_OBJECT(ch->call),
-                       G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0,
-                       NULL, G_CALLBACK(relink_state_cb), ch);
 }
 
 /* Delete ZrtpChannel when zrtpfilter is removed from bin */
@@ -177,7 +160,6 @@
        ch->linkedflags = ZRTP_LINKED_NONE;
        ch->zrtpfilter = create_zrtpfilter(ch);
 
-       connect_call(ch);
        connect_filter(ch);
        return ch;
 }
@@ -192,7 +174,6 @@
                ch->zrtpfilter = NULL;
        }
 
-       disconnect_call(ch);
        g_free(ch);
 }
 
@@ -236,7 +217,7 @@
 
        success = TRUE;
        ch->linkedflags &= ~flag;
-       g_signal_emit_by_name(ch->call, "relink-state", ch->linkedflags, ch);
+       relink_state(ch);
 
 cleanup:
        gst_object_unref(GST_OBJECT(zrtpsrc));
@@ -244,7 +225,7 @@
        gst_object_unref(GST_OBJECT(src));
        gst_object_unref(GST_OBJECT(zrtpsink));
 
-       // DEBUG_ZRTPCHANNEL(ch, "revert_pads(): %s", success ? 
"success":"failed!");
+       DEBUG_ZRTPCHANNEL(ch, "revert_pads(): %s", success ? 
"success":"failed!");
        return success;
 }
 
@@ -274,7 +255,7 @@
        if (ch->linkedflags & flag)
                g_warning("This zrtp pad was already linked!");
        ch->linkedflags |= flag;
-       g_signal_emit_by_name(ch->call, "relink-state", ch->linkedflags, ch);
+       relink_state(ch);
 
 cleanup:
        gst_object_unref(GST_OBJECT(src));


_______________________________________________
Pidgin-zrtp-commits mailing list
Pidgin-zrtp-commits@gna.org
https://mail.gna.org/listinfo/pidgin-zrtp-commits

Reply via email to