Mercurial > pidgin.yaz
changeset 29556:74e75fc3481e
Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
author | maiku@pidgin.im |
---|---|
date | Mon, 26 Oct 2009 17:39:38 +0000 |
parents | cc978a1a4bd1 |
children | 1fdc75c94c22 |
files | libpurple/media/backend-fs2.c libpurple/media/media.c |
diffstat | 2 files changed, 51 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media/backend-fs2.c Fri Oct 23 23:12:57 2009 +0000 +++ b/libpurple/media/backend-fs2.c Mon Oct 26 17:39:38 2009 +0000 @@ -574,9 +574,10 @@ 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 @@ 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;
--- a/libpurple/media/media.c Fri Oct 23 23:12:57 2009 +0000 +++ b/libpurple/media/media.c Mon Oct 26 17:39:38 2009 +0000 @@ -143,9 +143,12 @@ 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 @@ "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 @@ 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 @@ /* 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; - - g_return_if_fail(FS_IS_STREAM(fsstream)); - g_return_if_fail(session != NULL); + guint id; - g_object_get(fsstream, "participant", &participant, NULL); - g_object_get(participant, "cname", &name, NULL); - g_object_unref(participant); + g_return_if_fail(PURPLE_IS_MEDIA(media)); - stream = purple_media_get_stream(session->media, session->id, name); + stream = purple_media_get_stream(media, sess_id, name); + id = purple_media_candidate_get_component_id(local_candidate); 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"); }