Commit 749d9eb2 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

soa_static.c: when generating offer with ordered mode, fill gaps in session

If session has m

darcs-hash:20080403150919-65a35-65e5aed879e9a1fcb55b74a8f2b5a9dc10a4fc4a.gz
parent 5c654faa
......@@ -805,34 +805,37 @@ int soa_sdp_upgrade(soa_session_t *ss,
soa_sdp_media_upgrade_rtpmaps(ss, m, rm);
}
}
else if (sss->sss_ordered_user) {
/* Update session with unused media in u_media */
else {
if (!sss->sss_reuse_rejected) {
/* Mark previously used slots */
for (i = 0; i < Ns; i++) {
if (s_media[i])
continue;
s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
if (sss->sss_ordered_user) {
/* Update session with unused media in u_media */
if (!sss->sss_reuse_rejected) {
/* Mark previously used slots */
for (i = 0; i < Ns; i++) {
if (s_media[i])
continue;
s_media[i] =
soa_sdp_make_rejected_media(home, o_media[i], session, 0);
}
}
}
for (j = 0; j < Nu; j++) {
if (u_media[j] == SDP_MEDIA_NONE)
continue;
for (j = 0; j < Nu; j++) {
if (u_media[j] == SDP_MEDIA_NONE)
continue;
for (i = 0; i < size - 1; i++) {
if (s_media[i] == NULL) {
s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
u2s[j] = i, s2u[i] = j;
break;
for (i = 0; i < size - 1; i++) {
if (s_media[i] == NULL) {
s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
u2s[j] = i, s2u[i] = j;
break;
}
}
}
assert(i != size - 1);
assert(i != size - 1);
}
}
}
else {
/* Match unused user media by media types with the existing session */
for (i = 0; i < Ns; i++) {
if (s_media[i])
......
......@@ -1389,9 +1389,6 @@ int test_media_replace2(struct context *ctx)
"v=0\r\n"
"o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5004 RTP/AVP 0 8\n"
"a=rtpmap:96 G7231/8000\n"
"a=rtpmap:97 G729/8000\n"
"m=image 5556 UDPTL t38\r\n"
"a=T38FaxVersion:0\r\n"
"a=T38MaxBitRate:9600\r\n"
......@@ -1399,12 +1396,16 @@ int test_media_replace2(struct context *ctx)
"a=T38FaxTranscodingMMR:0\r\n"
"a=T38FaxTranscodingJBIG:0\r\n"
"a=T38FaxRateManagement:transferredTCF\r\n"
"a=T38FaxMaxDatagram:400\r\n";
"a=T38FaxMaxDatagram:400\r\n"
"m=audio 5004 RTP/AVP 0 8\n"
"a=rtpmap:96 G7231/8000\n"
"a=rtpmap:97 G729/8000\n";
char const a_caps2[] =
"v=0\r\n"
"o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=image 0 UDPTL t38\r\n"
"m=image 5004 UDPTL t38\r\n"
"a=T38FaxVersion:0\r\n"
"a=T38MaxBitRate:9600\r\n"
......@@ -1464,15 +1465,15 @@ int test_media_replace2(struct context *ctx)
TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
TEST_1(a_sdp->sdp_media);
TEST_1(a_sdp->sdp_media->m_type == sdp_media_audio);
TEST_1(a_sdp->sdp_media->m_type == sdp_media_image);
TEST_1(a_sdp->sdp_media->m_next);
TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_image);
TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_audio);
/* ---------------------------------------------------------------------- */
/* Re-O/A: replace media stream */
/* Accept media without common codecs */
/* Do not accept media without common codecs */
TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
SOATAG_USER_SDP_STR(b_caps2),
TAG_END()) > 0);
......@@ -1481,7 +1482,7 @@ int test_media_replace2(struct context *ctx)
n = soa_get_local_sdp(b, &b_sdp, &offer, &offerlen); TEST(n, 1);
TEST_1(offer != NULL && offer != NONE);
n = soa_set_remote_sdp(a, 0, offer, offerlen); TEST(n, 1);
/*printf("offer 2:\n%s", offer);*/
printf("offer 2:\n%s", offer);
TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
SOATAG_USER_SDP_STR(a_caps2),
TAG_END()) > 0);
......@@ -1489,7 +1490,7 @@ int test_media_replace2(struct context *ctx)
n = soa_generate_answer(a, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &a_sdp, &answer, &answerlen); TEST(n, 1);
TEST_1(answer != NULL && answer != NONE);
/*printf("answer 2:\n%s", answer);*/
printf("answer 2:\n%s", answer);
n = soa_set_remote_sdp(b, 0, answer, -1); TEST(n, 1);
n = soa_process_answer(b, test_completed); TEST(n, 0);
n = soa_get_local_sdp(b, &b_sdp, NULL, NULL); TEST(n, 1);
......@@ -1500,13 +1501,15 @@ int test_media_replace2(struct context *ctx)
TEST_1(soa_is_complete(b));
TEST(soa_activate(b, NULL), 0);
TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
TEST_1(m = a_sdp->sdp_media); TEST_1(m->m_rejected);
TEST_1(m = m->m_next);
TEST(m->m_type, sdp_media_image);
TEST(m->m_proto, sdp_proto_udptl);
TEST_1(m->m_format);
TEST_S(m->m_format->l_text, "t38");
TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
TEST_1(m = b_sdp->sdp_media); TEST_1(m->m_rejected);
TEST_1(m = m->m_next);
TEST(m->m_type, sdp_media_image);
TEST(m->m_proto, sdp_proto_udptl);
TEST_1(m->m_format);
......
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