| 632 g_free(foundation); |
632 g_free(foundation); |
| 633 g_free(ip); |
633 g_free(ip); |
| 634 return fscandidate; |
634 return fscandidate; |
| 635 } |
635 } |
| 636 |
636 |
| 637 static GList * |
|
| 638 candidate_list_to_fs(GList *candidates) |
|
| 639 { |
|
| 640 GList *new_list = NULL; |
|
| 641 |
|
| 642 for (; candidates; candidates = g_list_next(candidates)) { |
|
| 643 new_list = g_list_prepend(new_list, |
|
| 644 candidate_to_fs(candidates->data)); |
|
| 645 } |
|
| 646 |
|
| 647 new_list = g_list_reverse(new_list); |
|
| 648 return new_list; |
|
| 649 } |
|
| 650 |
|
| 651 static PurpleMediaCandidate * |
637 static PurpleMediaCandidate * |
| 652 candidate_from_fs(FsCandidate *fscandidate) |
638 candidate_from_fs(FsCandidate *fscandidate) |
| 653 { |
639 { |
| 654 PurpleMediaCandidate *candidate; |
640 PurpleMediaCandidate *candidate; |
| 655 |
641 |
| 669 "password", fscandidate->password, |
655 "password", fscandidate->password, |
| 670 "ttl", fscandidate->ttl, NULL); |
656 "ttl", fscandidate->ttl, NULL); |
| 671 return candidate; |
657 return candidate; |
| 672 } |
658 } |
| 673 |
659 |
| 674 static GList * |
|
| 675 candidate_list_from_fs(GList *candidates) |
|
| 676 { |
|
| 677 GList *new_list = NULL; |
|
| 678 |
|
| 679 for (; candidates; candidates = g_list_next(candidates)) { |
|
| 680 new_list = g_list_prepend(new_list, |
|
| 681 candidate_from_fs(candidates->data)); |
|
| 682 } |
|
| 683 |
|
| 684 new_list = g_list_reverse(new_list); |
|
| 685 return new_list; |
|
| 686 } |
|
| 687 |
|
| 688 static FsCodec * |
660 static FsCodec * |
| 689 codec_to_fs(const PurpleMediaCodec *codec) |
661 codec_to_fs(const PurpleMediaCodec *codec) |
| 690 { |
662 { |
| 691 FsCodec *new_codec; |
663 FsCodec *new_codec; |
| 692 gint id; |
664 gint id; |
| 742 purple_media_codec_add_optional_parameter(new_codec, |
714 purple_media_codec_add_optional_parameter(new_codec, |
| 743 param->name, param->value); |
715 param->name, param->value); |
| 744 } |
716 } |
| 745 |
717 |
| 746 return new_codec; |
718 return new_codec; |
| 747 } |
|
| 748 |
|
| 749 static GList * |
|
| 750 codec_list_from_fs(GList *codecs) |
|
| 751 { |
|
| 752 GList *new_list = NULL; |
|
| 753 |
|
| 754 for (; codecs; codecs = g_list_next(codecs)) { |
|
| 755 new_list = g_list_prepend(new_list, |
|
| 756 codec_from_fs(codecs->data)); |
|
| 757 } |
|
| 758 |
|
| 759 new_list = g_list_reverse(new_list); |
|
| 760 return new_list; |
|
| 761 } |
|
| 762 |
|
| 763 static GList * |
|
| 764 codec_list_to_fs(GList *codecs) |
|
| 765 { |
|
| 766 GList *new_list = NULL; |
|
| 767 |
|
| 768 for (; codecs; codecs = g_list_next(codecs)) { |
|
| 769 new_list = g_list_prepend(new_list, |
|
| 770 codec_to_fs(codecs->data)); |
|
| 771 } |
|
| 772 |
|
| 773 new_list = g_list_reverse(new_list); |
|
| 774 return new_list; |
|
| 775 } |
719 } |
| 776 |
720 |
| 777 static PurpleMediaBackendFs2Session * |
721 static PurpleMediaBackendFs2Session * |
| 778 get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id) |
722 get_session(PurpleMediaBackendFs2 *self, const gchar *sess_id) |
| 779 { |
723 { |
| 2165 participant ? participant : "(null)"); |
2109 participant ? participant : "(null)"); |
| 2166 return; |
2110 return; |
| 2167 } |
2111 } |
| 2168 |
2112 |
| 2169 stream->remote_candidates = g_list_concat(stream->remote_candidates, |
2113 stream->remote_candidates = g_list_concat(stream->remote_candidates, |
| 2170 candidate_list_to_fs(remote_candidates)); |
2114 g_list_copy_deep(remote_candidates, (GCopyFunc)candidate_to_fs, NULL)); |
| 2171 |
2115 |
| 2172 if (purple_media_is_initiator(priv->media, sess_id, participant) || |
2116 if (purple_media_is_initiator(priv->media, sess_id, participant) || |
| 2173 purple_media_accepted( |
2117 purple_media_accepted( |
| 2174 priv->media, sess_id, participant)) { |
2118 priv->media, sess_id, participant)) { |
| 2175 |
2119 |
| 2272 if (session == NULL) |
2216 if (session == NULL) |
| 2273 return NULL; |
2217 return NULL; |
| 2274 |
2218 |
| 2275 g_object_get(G_OBJECT(session->session), |
2219 g_object_get(G_OBJECT(session->session), |
| 2276 "codecs", &fscodecs, NULL); |
2220 "codecs", &fscodecs, NULL); |
| 2277 codecs = codec_list_from_fs(fscodecs); |
2221 codecs = g_list_copy_deep(fscodecs, (GCopyFunc)codec_from_fs, NULL); |
| 2278 fs_codec_list_destroy(fscodecs); |
2222 fs_codec_list_destroy(fscodecs); |
| 2279 |
2223 |
| 2280 return codecs; |
2224 return codecs; |
| 2281 } |
2225 } |
| 2282 |
2226 |
| 2290 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
2234 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL); |
| 2291 |
2235 |
| 2292 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self), |
2236 stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self), |
| 2293 sess_id, participant); |
2237 sess_id, participant); |
| 2294 |
2238 |
| 2295 if (stream != NULL) |
2239 if (stream != NULL) { |
| 2296 candidates = candidate_list_from_fs( |
2240 candidates = g_list_copy_deep(stream->local_candidates, |
| 2297 stream->local_candidates); |
2241 (GCopyFunc)candidate_from_fs, NULL); |
| |
2242 } |
| 2298 return candidates; |
2243 return candidates; |
| 2299 } |
2244 } |
| 2300 |
2245 |
| 2301 static gboolean |
2246 static gboolean |
| 2302 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, |
2247 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, |
| 2312 sess_id, participant); |
2257 sess_id, participant); |
| 2313 |
2258 |
| 2314 if (stream == NULL) |
2259 if (stream == NULL) |
| 2315 return FALSE; |
2260 return FALSE; |
| 2316 |
2261 |
| 2317 fscodecs = codec_list_to_fs(codecs); |
2262 fscodecs = g_list_copy_deep(codecs, (GCopyFunc)codec_to_fs, NULL); |
| 2318 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err); |
2263 fs_stream_set_remote_codecs(stream->stream, fscodecs, &err); |
| 2319 fs_codec_list_destroy(fscodecs); |
2264 fs_codec_list_destroy(fscodecs); |
| 2320 |
2265 |
| 2321 if (err) { |
2266 if (err) { |
| 2322 purple_debug_error("backend-fs2", |
2267 purple_debug_error("backend-fs2", |