neels has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/35301?usp=email )

 (

5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: mgcp_codec_decide: remove redundant lookup
......................................................................

mgcp_codec_decide: remove redundant lookup

We already did a lookup from conn_src[i] and found a matching
codec_conn_dst, no need to do another reverse lookup to end up at the
same conn_src[i] codec.

Change-Id: Iecc7f22c551fd17b23db434fdb177266407d2621
---
M src/libosmo-mgcp/mgcp_codec.c
1 file changed, 20 insertions(+), 8 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/src/libosmo-mgcp/mgcp_codec.c b/src/libosmo-mgcp/mgcp_codec.c
index d340e11..4626d03 100644
--- a/src/libosmo-mgcp/mgcp_codec.c
+++ b/src/libosmo-mgcp/mgcp_codec.c
@@ -431,13 +431,13 @@
         * of a match set this codec on both connections. This would be an 
ideal selection since no codec conversion would be
         * required. */
        for (i = 0; i < conn_src->end.codecs_assigned; i++) {
-               struct mgcp_rtp_codec *codec_conn_dst = 
mgcp_codec_find_same(conn_dst, &conn_src->end.codecs[i]);
+               struct mgcp_rtp_codec *codec_conn_src = 
&conn_src->end.codecs[i];
+               struct mgcp_rtp_codec *codec_conn_dst = 
mgcp_codec_find_same(conn_dst, codec_conn_src);
                if (codec_conn_dst) {
                        /* We found the a codec that is exactly the same (same 
codec, same payload format etc.) on both
                         * sides. We now set this codec on both connections. */
                        conn_dst->end.codec = codec_conn_dst;
-                       conn_src->end.codec = mgcp_codec_find_same(conn_src, 
codec_conn_dst);
-                       OSMO_ASSERT(conn_src->end.codec);
+                       conn_src->end.codec = codec_conn_src;
                        return 0;
                }
        }
@@ -445,13 +445,12 @@
        /* In case we could not find a codec that is exactly the same, let's at 
least try to find a codec that we are able
         * to convert. */
        for (i = 0; i < conn_src->end.codecs_assigned; i++) {
-               struct mgcp_rtp_codec *codec_conn_dst = 
codec_find_convertible(conn_dst, &conn_src->end.codecs[i]);
+               struct mgcp_rtp_codec *codec_conn_src = 
&conn_src->end.codecs[i];
+               struct mgcp_rtp_codec *codec_conn_dst = 
codec_find_convertible(conn_dst, codec_conn_src);
                if (codec_conn_dst) {
-                       /* We found the a codec that we are able to convert on 
both sides. We now set this codec on both
-                        * connections. */
+                       /* We found the a codec that we can convert to. Set 
each side to its codec. */
                        conn_dst->end.codec = codec_conn_dst;
-                       conn_src->end.codec = codec_find_convertible(conn_src, 
codec_conn_dst);
-                       OSMO_ASSERT(conn_src->end.codec);
+                       conn_src->end.codec = codec_conn_src;
                        return 0;
                }
        }

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Iecc7f22c551fd17b23db434fdb177266407d2621
Gerrit-Change-Number: 35301
Gerrit-PatchSet: 6
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to