[Asterisk-code-review] res rtp asterisk.c: Add "seqno" strictrtp option (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Wed Sep 26 10:28:59 CDT 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/10246 )

Change subject: res_rtp_asterisk.c: Add "seqno" strictrtp option
......................................................................


Patch Set 4: Code-Review-1

(3 comments)

https://gerrit.asterisk.org/#/c/10246/4/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

https://gerrit.asterisk.org/#/c/10246/4/res/res_rtp_asterisk.c@191
PS4, Line 191: static int strict_rtp_test_event = 1;
If TEST_FRAMEWORK is not defined this will cause a not used warning/error.

Since this is only used in one place, see my comment where it is used.


https://gerrit.asterisk.org/#/c/10246/4/res/res_rtp_asterisk.c@5532
PS4, Line 5532: #ifdef TEST_FRAMEWORK
              : 		if (strict_rtp_test_event) {
              : 			ast_test_suite_event_notify("STRICT_RTP_CLOSED", "Source: %s",
              : 				ast_sockaddr_stringify(&addr));
              : 			strict_rtp_test_event = 0; /* Only run this event once to prevent possible spam */
              : 		}
              : #endif
This can be surrounded by curlies to declare strict_rtp_test_event here in one place.

#ifdef TEST_FRAMEWORK
    {
        static int strict_rtp_test_event = 1;

        if (strict_rtp_test_event) {
            strict_rtp_test_event = 0;
            ast_test_suite_event_notify(...);
        }
    }
#endif


https://gerrit.asterisk.org/#/c/10246/4/res/res_rtp_asterisk.c@6678
PS4, Line 6678: 		strictrtp = ast_true(s);
              : 		if (!strcasecmp(s, "seqno")) {
              : 			strictrtp = STRICT_RTP_SEQNO;
              : 		} else if (strictrtp == -1) {
              : 			/* Stick to enum values for consistency */
              : 			strictrtp = STRICT_RTP_YES;
              : 		}
Better to only set strictrtp to the correct enum value rather than having momentary non-enum values:

if (ast_true(s)) {
   strictrtp = STRICT_RTP_YES;
} else if (!strcasecmp(s, "seqno")) {
   strictrtp = STRICT_RTP_SEQNO;
} else {
   strictrtp = STRICT_RTP_NO;
}



-- 
To view, visit https://gerrit.asterisk.org/10246
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I8a42b8d193673899c8fc22fe7f98ea87df89be71
Gerrit-Change-Number: 10246
Gerrit-PatchSet: 4
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 26 Sep 2018 15:28:59 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180926/14b024cf/attachment.html>


More information about the asterisk-code-review mailing list