Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
neels has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. differentiate AMR octet-aligned=0 vs =1 Add corresponding tests in mgcp_test.c Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 --- M src/libosmo-mgcp/mgcp_codec.c M tests/mgcp/mgcp_test.c M tests/mgcp/mgcp_test.ok 3 files changed, 104 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved keith: Looks good to me, but someone else must approve diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c index 7f1a6d1..5d7f840 100644 --- a/src/libosmo-mgcp/mgcp_codec.c +++ b/src/libosmo-mgcp/mgcp_codec.c @@ -348,6 +348,25 @@ return -EINVAL; } +/* Return true if octet-aligned is set in the given codec. Default to octet-aligned=0, i.e. bandwidth-efficient mode. + * See RFC4867 "RTP Payload Format for AMR and AMR-WB" sections "8.1. AMR Media Type Registration" and "8.2. AMR-WB + * Media Type Registration": + * + *octet-align: Permissible values are 0 and 1. If 1, octet-aligned + * operation SHALL be used. If 0 or if not present, + * bandwidth-efficient operation is employed. + * + * https://tools.ietf.org/html/rfc4867 + */ +static bool amr_is_octet_aligned(const struct mgcp_rtp_codec *codec) +{ + if (!codec->param_present) + return false; + if (!codec->param.amr_octet_aligned_present) + return false; + return codec->param.amr_octet_aligned; +} + /* Compare two codecs, all parameters must match up, except for the payload type * number. */ static bool codecs_same(struct mgcp_rtp_codec *codec_a, struct mgcp_rtp_codec *codec_b) @@ -364,6 +383,10 @@ return false; if (strcmp(codec_a->subtype_name, codec_b->subtype_name)) return false; + if (!strcmp(codec_a->subtype_name, "AMR")) { + if (amr_is_octet_aligned(codec_a) != amr_is_octet_aligned(codec_b)) + return false; + } return true; } diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c index 460ea9b..5ebe475 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -1716,7 +1716,6 @@ .amr_octet_aligned = true, }; -#if 0 static const struct mgcp_codec_param amr_param_octet_aligned_false = { .amr_octet_aligned_present = true, .amr_octet_aligned = false, @@ -1725,7 +1724,6 @@ static const struct mgcp_codec_param amr_param_octet_aligned_unset = { .amr_octet_aligned_present = false, }; -#endif struct testcase_mgcp_codec_pt_translate_codec { int payload_type; @@ -1850,6 +1848,58 @@ { .end = true }, }, }, + { + .descr = "test AMR with differing octet-aligned settings", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", _param_octet_aligned_false, }, + { 121, "AMR/8000", _param_octet_aligned_true, }, + }, + }, + .expect = { + { .payload_type_map = {111, 121}, }, + { .payload_type_map = {112, 122} }, + { .end = true }, + }, + }, + { + .descr = "test AMR with missing octet-aligned settings (defaults to 0)", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", _param_octet_aligned_unset, }, + }, + }, + .expect = { + { .payload_type_map = {111, -EINVAL}, }, + { .payload_type_map = {112, 122} }, + { .end = true }, + }, + }, + { + .descr = "test AMR with NULL param (defaults to 0)", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", NULL, }, + }, + }, + .expect = { + { .payload_type_map = {111, -EINVAL}, }, + {
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
keith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 3: Code-Review+1 :) -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 3 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 13 Aug 2019 09:54:24 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 3 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-Comment-Date: Tue, 13 Aug 2019 09:34:22 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
Hello pespin, keith, laforge, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 to look at the new patch set (#3). Change subject: differentiate AMR octet-aligned=0 vs =1 .. differentiate AMR octet-aligned=0 vs =1 Add corresponding tests in mgcp_test.c Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 --- M src/libosmo-mgcp/mgcp_codec.c M tests/mgcp/mgcp_test.c M tests/mgcp/mgcp_test.ok 3 files changed, 104 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/36/15136/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 3 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-MessageType: newpatchset
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c File src/libosmo-mgcp/mgcp_codec.c: https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c@361 PS1, Line 361: /* Default to octet-aligned=0, i.e. bandwidth-efficient mode */ > http://git.osmocom. […] yes did check, will add a pointer -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 2 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: pespin Gerrit-Comment-Date: Mon, 12 Aug 2019 22:42:16 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Comment-In-Reply-To: keith Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
Hello pespin, keith, laforge, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 to look at the new patch set (#2). Change subject: differentiate AMR octet-aligned=0 vs =1 .. differentiate AMR octet-aligned=0 vs =1 Add corresponding tests in mgcp_test.c Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 --- M src/libosmo-mgcp/mgcp_codec.c M tests/mgcp/mgcp_test.c M tests/mgcp/mgcp_test.ok 3 files changed, 95 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/36/15136/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 2 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-MessageType: newpatchset
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Fri, 09 Aug 2019 12:13:57 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
keith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c File src/libosmo-mgcp/mgcp_codec.c: https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c@361 PS1, Line 361: /* Default to octet-aligned=0, i.e. bandwidth-efficient mode */ > it is http://git.osmocom.org/osmo-sip-connector/commit/?id=b6032727870ab2b98372b697d91f7256da4f32b3 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Fri, 09 Aug 2019 12:06:43 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Comment-In-Reply-To: keith Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
keith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c File src/libosmo-mgcp/mgcp_codec.c: https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c@361 PS1, Line 361: /* Default to octet-aligned=0, i.e. bandwidth-efficient mode */ > Just to make sure, did you check in the specs if bandwidth-efficient is the > default? it is -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Fri, 09 Aug 2019 12:04:24 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c File src/libosmo-mgcp/mgcp_codec.c: https://gerrit.osmocom.org/#/c/15136/1/src/libosmo-mgcp/mgcp_codec.c@361 PS1, Line 361: /* Default to octet-aligned=0, i.e. bandwidth-efficient mode */ Just to make sure, did you check in the specs if bandwidth-efficient is the default? -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-CC: pespin Gerrit-Comment-Date: Fri, 09 Aug 2019 11:13:19 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
keith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: keith Gerrit-Reviewer: laforge Gerrit-Comment-Date: Fri, 09 Aug 2019 11:05:30 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 ) Change subject: differentiate AMR octet-aligned=0 vs =1 .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/15136 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 Gerrit-Change-Number: 15136 Gerrit-PatchSet: 1 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Comment-Date: Fri, 09 Aug 2019 08:20:58 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-mgw[master]: differentiate AMR octet-aligned=0 vs =1
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/15136 Change subject: differentiate AMR octet-aligned=0 vs =1 .. differentiate AMR octet-aligned=0 vs =1 Add corresponding tests in mgcp_test.c Change-Id: Ib8be73a7ca1b95ce794d130e8eb206dcee700124 --- M src/libosmo-mgcp/mgcp_codec.c M tests/mgcp/mgcp_test.c M tests/mgcp/mgcp_test.ok 3 files changed, 95 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/36/15136/1 diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c index b27c60d..ead1412 100644 --- a/src/libosmo-mgcp/mgcp_codec.c +++ b/src/libosmo-mgcp/mgcp_codec.c @@ -358,6 +358,16 @@ return -EINVAL; } +/* Default to octet-aligned=0, i.e. bandwidth-efficient mode */ +static bool amr_is_octet_aligned(const struct mgcp_rtp_codec *codec) +{ + if (!codec->param_present) + return false; + if (!codec->param.amr_octet_aligned_present) + return false; + return codec->param.amr_octet_aligned; +} + /* Compare two codecs, all parameters must match up, except for the payload type * number. */ static bool codecs_same(struct mgcp_rtp_codec *codec_a, struct mgcp_rtp_codec *codec_b) @@ -374,6 +384,10 @@ return false; if (strcmp(codec_a->subtype_name, codec_b->subtype_name)) return false; + if (!strcmp(codec_a->subtype_name, "AMR")) { + if (amr_is_octet_aligned(codec_a) != amr_is_octet_aligned(codec_b)) + return false; + } return true; } diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c index 44e8234..5d4267f 100644 --- a/tests/mgcp/mgcp_test.c +++ b/tests/mgcp/mgcp_test.c @@ -1716,7 +1716,6 @@ .amr_octet_aligned = true, }; -#if 0 static const struct mgcp_codec_param amr_param_octet_aligned_false = { .amr_octet_aligned_present = true, .amr_octet_aligned = false, @@ -1725,7 +1724,6 @@ static const struct mgcp_codec_param amr_param_octet_aligned_unset = { .amr_octet_aligned_present = false, }; -#endif struct testcase_mgcp_codec_pt_translate_codec { int payload_type; @@ -1850,6 +1848,58 @@ { .end = true }, }, }, + { + .descr = "test AMR with differing octet-aligned settings", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", _param_octet_aligned_false, }, + { 121, "AMR/8000", _param_octet_aligned_true, }, + }, + }, + .expect = { + { .payload_type_map = {111, 121}, }, + { .payload_type_map = {112, 122} }, + { .end = true }, + }, + }, + { + .descr = "test AMR with missing octet-aligned settings (defaults to 0)", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", _param_octet_aligned_unset, }, + }, + }, + .expect = { + { .payload_type_map = {111, -EINVAL}, }, + { .payload_type_map = {112, 122} }, + { .end = true }, + }, + }, + { + .descr = "test AMR with NULL param (defaults to 0)", + .codecs = { + { + { 111, "AMR/8000", _param_octet_aligned_true, }, + { 112, "AMR/8000", _param_octet_aligned_false, }, + }, + { + { 122, "AMR/8000", NULL, }, + }, + }, + .expect = { + { .payload_type_map = {111, -EINVAL}, }, + { .payload_type_map = {112, 122} }, + { .end = true }, + }, + }, }; static void test_mgcp_codec_pt_translate(void) diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok index 13d1870..35ca92b 100644 --- a/tests/mgcp/mgcp_test.ok +++ b/tests/mgcp/mgcp_test.ok @@ -1286,6 +1286,35 @@ - mgcp_codec_pt_translate(conn0, conn1, 112) -> -22 - mgcp_codec_pt_translate(conn0, conn1, 0) -> -22 - mgcp_codec_pt_translate(conn0, conn1, 111) -> -22 +#5: test AMR with differing octet-aligned