Mercurial > pidgin
comparison libpurple/protocols/jabber/jingle/rtp.c @ 26311:0083c73e004b
Move sending session-initiate out of the ready-new callback.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 19 Mar 2009 23:03:43 +0000 |
parents | f34fd86de085 |
children | 96ffb196d18d |
comparison
equal
deleted
inserted
replaced
26310:17929a84c1fb | 26311:0083c73e004b |
---|---|
333 } else { | 333 } else { |
334 return NULL; | 334 return NULL; |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 static void jingle_rtp_send_initiate(JingleSession *session); | |
339 | |
338 static void | 340 static void |
339 jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name, | 341 jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name, |
340 JingleSession *session) | 342 JingleSession *session) |
341 { | 343 { |
342 purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n"); | 344 purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n"); |
370 g_list_free(candidates); | 372 g_list_free(candidates); |
371 g_object_unref(oldtransport); | 373 g_object_unref(oldtransport); |
372 | 374 |
373 jingle_content_set_pending_transport(content, transport); | 375 jingle_content_set_pending_transport(content, transport); |
374 jingle_content_accept_transport(content); | 376 jingle_content_accept_transport(content); |
377 | |
378 jingle_rtp_send_initiate(session); | |
375 } | 379 } |
376 | 380 |
377 static void | 381 static void |
378 jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, | 382 jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, |
379 JingleSession *session) | 383 JingleSession *session) |
380 { | 384 { |
381 purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " | 385 purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " |
382 "session_id: %s jingle_session: %p\n", sid, session); | 386 "session_id: %s jingle_session: %p\n", sid, session); |
387 jingle_rtp_send_initiate(session); | |
383 } | 388 } |
384 | 389 |
385 static void | 390 static void |
386 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) | 391 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) |
387 { | 392 { |
432 jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) | 437 jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) |
433 { | 438 { |
434 purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name); | 439 purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name); |
435 | 440 |
436 if (sid == NULL && name == NULL) { | 441 if (sid == NULL && name == NULL) { |
437 if (jingle_session_is_initiator(session) == TRUE) { | 442 if (jingle_session_is_initiator(session) == FALSE) { |
438 JabberIq *iq = jingle_session_to_packet( | |
439 session, JINGLE_SESSION_INITIATE); | |
440 jabber_iq_set_callback(iq, | |
441 jingle_rtp_initiate_ack_cb, session); | |
442 jabber_iq_send(iq); | |
443 g_signal_connect(G_OBJECT(media), "new-candidate", | |
444 G_CALLBACK(jingle_rtp_new_candidate_cb), session); | |
445 } else { | |
446 jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT)); | 443 jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT)); |
447 g_signal_connect(G_OBJECT(media), "new-candidate", | 444 g_signal_connect(G_OBJECT(media), "new-candidate", |
448 G_CALLBACK(jingle_rtp_new_candidate_cb), session); | 445 G_CALLBACK(jingle_rtp_new_candidate_cb), session); |
449 } | 446 } |
450 } | 447 } |
460 type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) && | 457 type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) && |
461 sid == NULL && name == NULL) { | 458 sid == NULL && name == NULL) { |
462 jabber_iq_send(jingle_session_terminate_packet( | 459 jabber_iq_send(jingle_session_terminate_packet( |
463 session, "success")); | 460 session, "success")); |
464 g_object_unref(session); | 461 g_object_unref(session); |
462 } | |
463 } | |
464 | |
465 static void | |
466 jingle_rtp_send_initiate(JingleSession *session) | |
467 { | |
468 PurpleMedia *media = jingle_rtp_get_media(session); | |
469 | |
470 if (jingle_session_is_initiator(session) == TRUE && | |
471 purple_media_codecs_ready(media, NULL) && | |
472 purple_media_candidates_prepared(media, NULL, NULL)) { | |
473 JabberIq *iq = jingle_session_to_packet( | |
474 session, JINGLE_SESSION_INITIATE); | |
475 jabber_iq_set_callback(iq, | |
476 jingle_rtp_initiate_ack_cb, session); | |
477 jabber_iq_send(iq); | |
478 g_signal_connect(G_OBJECT(media), "new-candidate", | |
479 G_CALLBACK(jingle_rtp_new_candidate_cb), | |
480 session); | |
465 } | 481 } |
466 } | 482 } |
467 | 483 |
468 static PurpleMedia * | 484 static PurpleMedia * |
469 jingle_rtp_create_media(JingleContent *content) | 485 jingle_rtp_create_media(JingleContent *content) |