aboutsummaryrefslogtreecommitdiffstats
path: root/main/rtp.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-18 02:02:54 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-18 02:02:54 +0000
commit2d8a9c69b532d23b68bd76c03ef450f1a45373c6 (patch)
tree496eea60079157b4f341cdac0f1706dce9530272 /main/rtp.c
parentdb2faf17bbce6750a3065edabcb2f1a69af88d68 (diff)
suppress smoothers for Siren codecs as well as Speex and G.723.1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176841 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r--main/rtp.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 8240a9fe3..e87d00b22 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -3735,16 +3735,27 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
rtp->smoother = NULL;
}
- if (!rtp->smoother && subclass != AST_FORMAT_SPEEX && subclass != AST_FORMAT_G723_1) {
+ if (!rtp->smoother) {
struct ast_format_list fmt = ast_codec_pref_getsize(&rtp->pref, subclass);
- if (fmt.inc_ms) { /* if codec parameters is set / avoid division by zero */
- if (!(rtp->smoother = ast_smoother_new((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms))) {
- ast_log(LOG_WARNING, "Unable to create smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
- return -1;
+
+ switch (subclass) {
+ case AST_FORMAT_SPEEX:
+ case AST_FORMAT_G723_1:
+ case AST_FORMAT_SIREN7:
+ case AST_FORMAT_SIREN14:
+ /* these are all frame-based codecs and cannot be safely run through
+ a smoother */
+ break;
+ default:
+ if (fmt.inc_ms) { /* if codec parameters is set / avoid division by zero */
+ if (!(rtp->smoother = ast_smoother_new((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms))) {
+ ast_log(LOG_WARNING, "Unable to create smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
+ return -1;
+ }
+ if (fmt.flags)
+ ast_smoother_set_flags(rtp->smoother, fmt.flags);
+ ast_debug(1, "Created smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
}
- if (fmt.flags)
- ast_smoother_set_flags(rtp->smoother, fmt.flags);
- ast_debug(1, "Created smoother: format: %d ms: %d len: %d\n", subclass, fmt.cur_ms, ((fmt.cur_ms * fmt.fr_len) / fmt.inc_ms));
}
}
if (rtp->smoother) {