cpw.maiku.media_refactor: 6fbf0527: Move Farsight 2's new-active-candidate-p...
maiku at pidgin.im
maiku at pidgin.im
Mon Oct 26 22:45:58 EDT 2009
-----------------------------------------------------------------
Revision: 6fbf0527701d00a524bd5c9073e98ed18161d5be
Ancestor: 9d59218f424b8b28e24d254faeaabfca5a4f139a
Author: maiku at pidgin.im
Date: 2009-10-26T17:39:38
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/6fbf0527701d00a524bd5c9073e98ed18161d5be
Modified files:
libpurple/media/backend-fs2.c libpurple/media/media.c
ChangeLog:
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c 43dbba00369e876a447b35a5112f96958810e91d
+++ libpurple/media/backend-fs2.c 799fb53dac7d35fc660412b8b8144a560ac5db8f
@@ -574,9 +574,10 @@ _gst_handle_message_element(GstBus *bus,
FsStream *stream;
FsCandidate *local_candidate;
FsCandidate *remote_candidate;
-#if 0
- PurpleMediaSession *session;
-#endif
+ FsParticipant *participant;
+ PurpleMediaBackendFs2Session *session;
+ PurpleMediaCandidate *lcandidate, *rcandidate;
+ gchar *name;
value = gst_structure_get_value(msg->structure, "stream");
stream = g_value_get_object(value);
@@ -586,11 +587,21 @@ _gst_handle_message_element(GstBus *bus,
value = gst_structure_get_value(msg->structure,
"remote-candidate");
remote_candidate = g_value_get_boxed(value);
-#if 0
- session = purple_media_session_from_fs_stream(media, stream);
- _candidate_pair_established_cb(stream, local_candidate,
- remote_candidate, session);
-#endif
+
+ g_object_get(stream, "participant", &participant, NULL);
+ g_object_get(participant, "cname", &name, NULL);
+ g_object_unref(participant);
+
+ session = _get_session_from_fs_stream(self, stream);
+
+ lcandidate = purple_media_candidate_from_fs(local_candidate);
+ rcandidate = purple_media_candidate_from_fs(remote_candidate);
+
+ g_signal_emit_by_name(self, "active-candidate-pair",
+ session->id, name, lcandidate, rcandidate);
+
+ g_object_unref(lcandidate);
+ g_object_unref(rcandidate);
} else if (gst_structure_has_name(msg->structure,
"farsight-recv-codecs-changed")) {
const GValue *value;
============================================================
--- libpurple/media/media.c f05a31977e1514595a3d6542c5a868c906287e5c
+++ libpurple/media/media.c 4e602cd9410f6a1839aefbce1357602a791064e9
@@ -143,9 +143,12 @@ static void purple_media_candidates_prep
PurpleMediaCandidate *candidate, PurpleMedia *media);
static void purple_media_candidates_prepared_cb(FsStream *stream,
PurpleMediaSession *session);
-static void purple_media_candidate_pair_established_cb(FsStream *stream,
- FsCandidate *native_candidate, FsCandidate *remote_candidate,
- PurpleMediaSession *session);
+static void purple_media_candidate_pair_established_cb(
+ PurpleMediaBackend *backend,
+ const gchar *sess_id, const gchar *name,
+ PurpleMediaCandidate *local_candidate,
+ PurpleMediaCandidate *remote_candidate,
+ PurpleMedia *media);
static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
const gchar *sess_id, PurpleMedia *media);
static gboolean media_bus_call(GstBus *bus,
@@ -442,6 +445,11 @@ purple_media_set_property (GObject *obje
"media", media,
NULL);
g_signal_connect(media->priv->backend,
+ "active-candidate-pair",
+ G_CALLBACK(
+ purple_media_candidate_pair_established_cb),
+ media);
+ g_signal_connect(media->priv->backend,
"codecs-changed",
G_CALLBACK(
purple_media_codecs_changed_cb),
@@ -1072,13 +1080,6 @@ media_bus_call(GstBus *bus, GstMessage *
FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
purple_media_candidates_prepared_cb(stream, session);
- } else if (gst_structure_has_name(msg->structure,
- "farsight-new-active-candidate-pair")) {
- FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
- FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "local-candidate"));
- FsCandidate *remote_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "remote-candidate"));
- PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
- purple_media_candidate_pair_established_cb(stream, local_candidate, remote_candidate, session);
}
break;
}
@@ -1297,60 +1298,62 @@ static void
/* callback called when a pair of transport candidates (local and remote)
* has been established */
static void
-purple_media_candidate_pair_established_cb(FsStream *fsstream,
- FsCandidate *native_candidate,
- FsCandidate *remote_candidate,
- PurpleMediaSession *session)
+purple_media_candidate_pair_established_cb(PurpleMediaBackend *backend,
+ const gchar *sess_id, const gchar *name,
+ PurpleMediaCandidate *local_candidate,
+ PurpleMediaCandidate *remote_candidate,
+ PurpleMedia *media)
{
- gchar *name;
- FsParticipant *participant;
PurpleMediaStream *stream;
GList *iter;
+ guint id;
- g_return_if_fail(FS_IS_STREAM(fsstream));
- g_return_if_fail(session != NULL);
+ g_return_if_fail(PURPLE_IS_MEDIA(media));
- g_object_get(fsstream, "participant", &participant, NULL);
- g_object_get(participant, "cname", &name, NULL);
- g_object_unref(participant);
+ stream = purple_media_get_stream(media, sess_id, name);
+ id = purple_media_candidate_get_component_id(local_candidate);
- stream = purple_media_get_stream(session->media, session->id, name);
-
iter = stream->active_local_candidates;
for(; iter; iter = g_list_next(iter)) {
FsCandidate *c = iter->data;
- if (native_candidate->component_id == c->component_id) {
+ if (id == c->component_id) {
fs_candidate_destroy(c);
stream->active_local_candidates =
g_list_delete_link(iter, iter);
stream->active_local_candidates = g_list_prepend(
stream->active_local_candidates,
- fs_candidate_copy(native_candidate));
+ purple_media_candidate_to_fs(
+ local_candidate));
break;
}
}
if (iter == NULL)
stream->active_local_candidates = g_list_prepend(
stream->active_local_candidates,
- fs_candidate_copy(native_candidate));
+ purple_media_candidate_to_fs(
+ local_candidate));
+ id = purple_media_candidate_get_component_id(local_candidate);
+
iter = stream->active_remote_candidates;
for(; iter; iter = g_list_next(iter)) {
FsCandidate *c = iter->data;
- if (native_candidate->component_id == c->component_id) {
+ if (id == c->component_id) {
fs_candidate_destroy(c);
stream->active_remote_candidates =
g_list_delete_link(iter, iter);
stream->active_remote_candidates = g_list_prepend(
stream->active_remote_candidates,
- fs_candidate_copy(remote_candidate));
+ purple_media_candidate_to_fs(
+ remote_candidate));
break;
}
}
if (iter == NULL)
stream->active_remote_candidates = g_list_prepend(
stream->active_remote_candidates,
- fs_candidate_copy(remote_candidate));
+ purple_media_candidate_to_fs(
+ remote_candidate));
purple_debug_info("media", "candidate pair established\n");
}
More information about the Commits
mailing list