comparison libpurple/protocols/jabber/jingle.c @ 25712:3ffe166a355e

Set the proper send codec in Farsight.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 23 Jul 2008 20:10:18 +0000
parents 23a156abcb2a
children 97f3a3409a1d
comparison
equal deleted inserted replaced
25711:a1acca6ff789 25712:3ffe166a355e
1194 purple_debug_info("jingle", "Found a suitable codec on stream = %d\n", 1194 purple_debug_info("jingle", "Found a suitable codec on stream = %d\n",
1195 top->id); 1195 top->id);
1196 1196
1197 /* we have found a suitable codec, but we will not start the stream 1197 /* we have found a suitable codec, but we will not start the stream
1198 just yet, wait for transport negotiation to complete... */ 1198 just yet, wait for transport negotiation to complete... */
1199 purple_media_set_send_codec(
1200 jabber_jingle_session_get_media(session),
1201 xmlnode_get_attrib(content, "name"),
1202 codec_intersection->data);
1199 } 1203 }
1200 /* if we also got transport candidates, add them to our streams 1204 /* if we also got transport candidates, add them to our streams
1201 list of known remote candidates */ 1205 list of known remote candidates */
1202 if (g_list_length(remote_transports) > 0) { 1206 if (g_list_length(remote_transports) > 0) {
1203 purple_media_add_remote_candidates(session->media, 1207 purple_media_add_remote_candidates(session->media,
1286 return; 1290 return;
1287 } 1291 }
1288 1292
1289 for (content = xmlnode_get_child(jingle, "content"); content; 1293 for (content = xmlnode_get_child(jingle, "content"); content;
1290 content = xmlnode_get_next_twin(content)) { 1294 content = xmlnode_get_next_twin(content)) {
1295 GList *codec_intersection = NULL;
1296
1291 /* init media */ 1297 /* init media */
1292 if (!content) { 1298 if (!content) {
1293 purple_debug_error("jingle", "jingle tag must contain content tag\n"); 1299 purple_debug_error("jingle", "jingle tag must contain content tag\n");
1294 /* should send error here */ 1300 /* should send error here */
1295 return; 1301 return;
1305 codecs = jabber_jingle_get_codecs(description); 1311 codecs = jabber_jingle_get_codecs(description);
1306 1312
1307 purple_media_set_remote_codecs(session->media, 1313 purple_media_set_remote_codecs(session->media,
1308 xmlnode_get_attrib(content, "name"), 1314 xmlnode_get_attrib(content, "name"),
1309 initiator, codecs); 1315 initiator, codecs);
1316
1317 codec_intersection = purple_media_get_negotiated_codecs(session->media,
1318 xmlnode_get_attrib(content, "name"));
1310 purple_debug_info("jingle", "codec intersection: %i\n", 1319 purple_debug_info("jingle", "codec intersection: %i\n",
1311 g_list_length(purple_media_get_negotiated_codecs(session->media, 1320 g_list_length(codec_intersection));
1312 xmlnode_get_attrib(content, "name")))); 1321
1322 if (g_list_length(codec_intersection) > 0) {
1323 purple_media_set_send_codec(
1324 jabber_jingle_session_get_media(session),
1325 xmlnode_get_attrib(content, "name"),
1326 codec_intersection->data);
1327 }
1313 } 1328 }
1314 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle)); 1329 jabber_iq_send(jabber_jingle_session_create_ack(session, jingle));
1315 jabber_iq_send(jabber_jingle_session_create_session_info(session, "ringing")); 1330 jabber_iq_send(jabber_jingle_session_create_session_info(session, "ringing"));
1316 1331
1317 purple_media_got_request(jabber_jingle_session_get_media(session)); 1332 purple_media_got_request(jabber_jingle_session_get_media(session));