[Asterisk-code-review] res rtp asterisk: avoid merging command and regular T140 tex... (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Thu Jul 19 11:50:57 CDT 2018


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

Change subject: res_rtp_asterisk: avoid merging command and regular T140 text packets
......................................................................


Patch Set 3: Code-Review-1

(2 comments)

https://gerrit.asterisk.org/#/c/9510/3/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

https://gerrit.asterisk.org/#/c/9510/3/res/res_rtp_asterisk.c@6105
PS3, Line 6105: 	if (!rtp->red) return 0;
Still missing curly braces.


https://gerrit.asterisk.org/#/c/9510/3/res/res_rtp_asterisk.c@6108
PS3, Line 6108: 		const unsigned char *primary = red->buf_data;
              : 		if (red->t140.datalen > 0 && (primary[0] == 0x08 || primary[0] == 0x0a || primary[0] == 0x0d)) {
              : 			/* flush previous t140 packet if it is a command */
              : 			ast_rtp_write(instance, &rtp->red->t140);
              : 		} else {
              : 			primary = frame->data.ptr;
              : 			if (primary[0] == 0x08 || primary[0] == 0x0a || primary[0] == 0x0d) {
              : 				/* flush previous t140 packet we send commands */
              : 				ast_rtp_write(instance, &rtp->red->t140);
              : 			}
              : 		}
I think the code should be this way:

if (red->t140.datalen > 0) {
   const unsigned char *primary = red->buf_data;

   /* There is something already in the T.140 buffer */
   if (primary[0] == 0x08 ....) {
       /* Flush the previous T.140 packet if it is a command */
       ast_rtp_write(instance, &rtp->red->t140);
   } else {
       primary = frame->data->ptr;
       if (primary[0] == 0x08 ....) {
          /* Flush the previous T.140 packet if we are buffering a command now */
          ast_rtp_write(instance, &rtp->red->t140);
       }
   }
}



-- 
To view, visit https://gerrit.asterisk.org/9510
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: Ifbe993311410fa855cb8aa4a12084db75f413462
Gerrit-Change-Number: 9510
Gerrit-PatchSet: 3
Gerrit-Owner: Emmanuel BUU <emmanuel.buu at ives.fr>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Thu, 19 Jul 2018 16:50:57 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180719/f37d94af/attachment.html>


More information about the asterisk-code-review mailing list