summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-01-30 10:02:14 -0500
committerSean Bright <sean.bright@gmail.com>2017-02-01 10:42:42 -0500
commit7a16524a83f5955624151d69bf1f9fe2b2211a9a (patch)
tree37ea9aee94fd138a9d76d061862a3606638f0695 /res/res_rtp_asterisk.c
parentb814343538545f5b9005d3c32c953d66b7967e03 (diff)
res_rtp_asterisk: Swap byte-order when sending signed linear
Before Asterisk 13, signed linear was converted into network byte order by a smoother before being sent over the network. We restore this behavior by forcing the creation of a smoother when slinear is in use and setting the appropriate flags so that the byte order conversion is always done. ASTERISK-24858 #close Reported-by: Frankie Chin Change-Id: I868449617d1a7819578f218c8c6b2111ad84f5a9
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r--res/res_rtp_asterisk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index c4608db6c..3d124000a 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3630,6 +3630,11 @@ static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *fr
/* If no smoother is present see if we have to set one up */
if (!rtp->smoother && ast_format_can_be_smoothed(format)) {
unsigned int framing_ms = ast_rtp_codecs_get_framing(ast_rtp_instance_get_codecs(instance));
+ int is_slinear = ast_format_cache_is_slinear(format);
+
+ if (!framing_ms && is_slinear) {
+ framing_ms = ast_format_get_default_ms(format);
+ }
if (framing_ms) {
rtp->smoother = ast_smoother_new((framing_ms * ast_format_get_minimum_bytes(format)) / ast_format_get_minimum_ms(format));
@@ -3638,6 +3643,9 @@ static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *fr
ast_format_get_name(format), framing_ms, ast_format_get_minimum_bytes(format));
return -1;
}
+ if (is_slinear) {
+ ast_smoother_set_flags(rtp->smoother, AST_SMOOTHER_FLAG_BE);
+ }
}
}