dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/27223 )


Change subject: mgcp_codec: do not differntiate between oe and bwe when 
comparing codec
......................................................................

mgcp_codec: do not differntiate between oe and bwe when comparing codec

AMR that has the payload format bandwith-efficient is the same codec as
AMR that has the payload format octet-aligned. Its the same codec, and a
comparison of the codec info with the function codecs_same() should
return true (=equel).

Change-Id: I64731570c287a75d39c79c10e1bc09a37bdd54d6
Related: SYS#5834
---
M src/libosmo-mgcp/mgcp_codec.c
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
3 files changed, 13 insertions(+), 28 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/23/27223/1

diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index 6b8d14a..38aa0a7 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -378,10 +378,10 @@
                return false;
        if (strcmp(codec_a->subtype_name, codec_b->subtype_name))
                return false;
-       if (!strcmp(codec_a->subtype_name, "AMR")) {
-               if (mgcp_codec_amr_is_octet_aligned(codec_a) != 
mgcp_codec_amr_is_octet_aligned(codec_b))
-                       return false;
-       }
+
+       /* Note: AMR allows to set the RTP payload format to octet-aligned or 
bandwith-efficient (octet-aligned=0)
+        * via SDP. This difference concerns payload format only, but not the 
actual codec. It is not a difference
+        * within the meaning of this function. */

        return true;
 }
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 9b4933c..4ed18c2 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -1896,16 +1896,13 @@
                .codecs = {
                        {
                                { 111, "AMR/8000", 
&amr_param_octet_aligned_true, },
-                               { 112, "AMR/8000", 
&amr_param_octet_aligned_false, },
                        },
                        {
                                { 122, "AMR/8000", 
&amr_param_octet_aligned_false, },
-                               { 121, "AMR/8000", 
&amr_param_octet_aligned_true, },
                        },
                },
                .expect = {
-                       { .payload_type_map = {111, 121}, },
-                       { .payload_type_map = {112, 122} },
+                       { .payload_type_map = {111, 122}, },
                        { .end = true },
                },
        },
@@ -1914,15 +1911,13 @@
                .codecs = {
                        {
                                { 111, "AMR/8000", 
&amr_param_octet_aligned_true, },
-                               { 112, "AMR/8000", 
&amr_param_octet_aligned_false, },
                        },
                        {
                                { 122, "AMR/8000", 
&amr_param_octet_aligned_unset, },
                        },
                },
                .expect = {
-                       { .payload_type_map = {111, -EINVAL}, },
-                       { .payload_type_map = {112, 122} },
+                       { .payload_type_map = {111, 122}, },
                        { .end = true },
                },
        },
@@ -1931,15 +1926,13 @@
                .codecs = {
                        {
                                { 111, "AMR/8000", 
&amr_param_octet_aligned_true, },
-                               { 112, "AMR/8000", 
&amr_param_octet_aligned_false, },
                        },
                        {
                                { 122, "AMR/8000", NULL, },
                        },
                },
                .expect = {
-                       { .payload_type_map = {111, -EINVAL}, },
-                       { .payload_type_map = {112, 122} },
+                       { .payload_type_map = {111, 122}, },
                        { .end = true },
                },
        },
diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok
index 94fada3..5b8d558 100644
--- a/tests/mgcp/mgcp_test.ok
+++ b/tests/mgcp/mgcp_test.ok
@@ -1347,32 +1347,24 @@
 #5: test AMR with differing octet-aligned settings
  - add codecs on conn0:
     0: 111 AMR/8000 octet-aligned=1  -> rc=0
-    1: 112 AMR/8000 octet-aligned=0  -> rc=0
  - add codecs on conn1:
     0: 122 AMR/8000 octet-aligned=0  -> rc=0
-    1: 121 AMR/8000 octet-aligned=1  -> rc=0
- - mgcp_codec_pt_translate(conn0, conn1, 111) -> 121
- - mgcp_codec_pt_translate(conn1, conn0, 121) -> 111
- - mgcp_codec_pt_translate(conn0, conn1, 112) -> 122
- - mgcp_codec_pt_translate(conn1, conn0, 122) -> 112
+ - mgcp_codec_pt_translate(conn0, conn1, 111) -> 122
+ - mgcp_codec_pt_translate(conn1, conn0, 122) -> 111
 #6: test AMR with missing octet-aligned settings (defaults to 0)
  - add codecs on conn0:
     0: 111 AMR/8000 octet-aligned=1  -> rc=0
-    1: 112 AMR/8000 octet-aligned=0  -> rc=0
  - add codecs on conn1:
     0: 122 AMR/8000 octet-aligned=unset  -> rc=0
- - mgcp_codec_pt_translate(conn0, conn1, 111) -> -22
- - mgcp_codec_pt_translate(conn0, conn1, 112) -> 122
- - mgcp_codec_pt_translate(conn1, conn0, 122) -> 112
+ - mgcp_codec_pt_translate(conn0, conn1, 111) -> 122
+ - mgcp_codec_pt_translate(conn1, conn0, 122) -> 111
 #7: test AMR with NULL param (defaults to 0)
  - add codecs on conn0:
     0: 111 AMR/8000 octet-aligned=1  -> rc=0
-    1: 112 AMR/8000 octet-aligned=0  -> rc=0
  - add codecs on conn1:
     0: 122 AMR/8000  -> rc=0
- - mgcp_codec_pt_translate(conn0, conn1, 111) -> -22
- - mgcp_codec_pt_translate(conn0, conn1, 112) -> 122
- - mgcp_codec_pt_translate(conn1, conn0, 122) -> 112
+ - mgcp_codec_pt_translate(conn0, conn1, 111) -> 122
+ - mgcp_codec_pt_translate(conn1, conn0, 122) -> 111
 #8: match FOO/8000/1 and FOO/8000 as identical, single channel is implicit
  - add codecs on conn0:
     0:   0 PCMU/8000/1  -> rc=0

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/27223
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I64731570c287a75d39c79c10e1bc09a37bdd54d6
Gerrit-Change-Number: 27223
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>
Gerrit-MessageType: newchange

Reply via email to