diff options
author | Joshua Colp <jcolp@digium.com> | 2016-03-31 07:04:48 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-03-31 07:04:48 -0500 |
commit | 6ad59a69f8265220082935c02c7ae01896674b8e (patch) | |
tree | 94deca0c0c4237d3e7d935a589abdab2b8e11b9b /res | |
parent | 61d03df059dd967f8ec585e1112a7749aef879a6 (diff) | |
parent | 8dc8d6ceb8539ab6bb025f9a2172f5fe594329d5 (diff) |
Merge "res_rtp_asterisk: Fix placement of txcount increment" into 13
Diffstat (limited to 'res')
-rw-r--r-- | res/res_rtp_asterisk.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 4c6ee185f..029aff01b 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -2252,7 +2252,6 @@ static int __rtp_sendto(struct ast_rtp_instance *instance, void *buf, size_t siz struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); struct ast_srtp *srtp = ast_rtp_instance_get_srtp(instance); int res; - int hdrlen = 12; *ice = 0; @@ -2260,9 +2259,6 @@ static int __rtp_sendto(struct ast_rtp_instance *instance, void *buf, size_t siz return -1; } - rtp->txcount++; - rtp->txoctetcount += (len - hdrlen); - #ifdef HAVE_PJPROJECT if (rtp->ice) { pj_thread_register_check(); @@ -2289,7 +2285,16 @@ static int rtcp_sendto(struct ast_rtp_instance *instance, void *buf, size_t size static int rtp_sendto(struct ast_rtp_instance *instance, void *buf, size_t size, int flags, struct ast_sockaddr *sa, int *ice) { - return __rtp_sendto(instance, buf, size, flags, sa, 0, ice, 1); + struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); + int hdrlen = 12; + int res; + + if ((res = __rtp_sendto(instance, buf, size, flags, sa, 0, ice, 1)) > 0) { + rtp->txcount++; + rtp->txoctetcount += (res - hdrlen); + } + + return res; } static int rtp_get_rate(struct ast_format *format) |