Commit 01d155af authored by Pekka Pessi's avatar Pekka Pessi

soa_static.c: fixed problem of a new offer not including active codec.

test_soa.c: added test for dropping codecs from new offer.

Based on patch by Legostayev Denis.

darcs-hash:20060906141017-65a35-b295ab4b9dc8be32db6288817d749ddaf6bfcb42.gz
parent 90ae1bc7
......@@ -999,8 +999,7 @@ static int offer_answer_step(soa_session_t *ss,
if (ss->ss_local_user_version == user_version &&
ss->ss_local_remote_version == remote_version)
break;
if (ss->ss_local_user_version != user_version ||
soa_sdp_upgrade_is_needed(local, remote)) {
if (1) {
if (local != local0)
*local0 = *local, local = local0;
SU_DEBUG_7(("soa_static(%p, %s): %s\n", ss, by,
......@@ -1062,10 +1061,9 @@ static int offer_answer_step(soa_session_t *ss,
break;
}
/* Step E: Upgrade codecs */
/* Step E: Upgrade codecs by answer. */
switch (action) {
case process_answer:
case generate_answer:
/* Upgrade local SDP based on remote SDP */
if (ss->ss_local_remote_version == remote_version)
break;
......@@ -1080,6 +1078,7 @@ static int offer_answer_step(soa_session_t *ss,
}
break;
case generate_offer:
case generate_answer:
default:
break;
}
......
......@@ -1015,6 +1015,90 @@ int test_codec_selection(struct context *ctx)
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(!m->m_next);
/* ---------------------------------------------------------------------- */
/* A drops GSM support */
TEST_1(soa_set_params(a,
SOATAG_USER_SDP_STR(
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5008 RTP/AVP 0 8 96 127\r\n"
"a=rtpmap:96 G729/8000\n"
"a=rtpmap:127 CN/8000\n"
"m=video 5010 RTP/AVP 31 34\r\n"
"m=audio 6008 RTP/SAVP 3\n"
),
TAG_END()));
/* B adds GSM to SRTP */
TEST_1(soa_set_params(b,
SOATAG_USER_SDP_STR(
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5004 RTP/AVP 96 3 97 111\r\n"
"a=rtpmap:96 G7231/8000\n"
"a=rtpmap:97 G729/8000\n"
"a=rtpmap:111 telephone-event/8000\n"
"a=fmtp:111 0-15\n"
"m=audio 6004 RTP/SAVP 96 3\n"
"a=rtpmap:96 G729/8000\n"
"m=video 5006 RTP/AVP 34\n"
),
TAG_END()));
n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &a_sdp, &offer, &offerlen); TEST(n, 1);
TEST_1(offer != NULL && offer != NONE);
TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(!m->m_next);
n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
n = soa_generate_answer(b, test_completed); TEST(n, 0);
/* Answer from B now accepts video */
n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
TEST_1(answer != NULL && answer != NONE);
n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
n = soa_process_answer(a, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &a_sdp, &offer, &offerlen); TEST(n, 1);
TEST_1(soa_is_complete(b));
TEST(soa_activate(b, NULL), 0);
TEST_1(soa_is_complete(a));
TEST(soa_activate(a, NULL), 0);
TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
TEST(soa_is_video_active(a), SOA_ACTIVE_SENDRECV);
TEST(soa_is_remote_video_active(a), SOA_ACTIVE_SENDRECV);
TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 96);
TEST_S(rm->rm_encoding, "G729");
TEST_1(rm = rm->rm_next); TEST(rm->rm_pt, 127);
TEST_S(rm->rm_encoding, "CN");
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 34);
TEST_S(rm->rm_encoding, "H263");
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(!m->m_next);
TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 96);
TEST_S(rm->rm_encoding, "G729");
TEST_1(rm = rm->rm_next); TEST(rm->rm_pt, 111);
TEST_S(rm->rm_encoding, "telephone-event");
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 34);
TEST_S(rm->rm_encoding, "H263");
TEST_1(m = m->m_next); TEST_1(!m->m_rejected);
TEST_1(!m->m_next);
/* ---------------------------------------------------------------------- */
TEST_VOID(soa_terminate(a, NULL));
TEST_VOID(soa_terminate(b, NULL));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment