diff options
author | Mark Michelson <mmichelson@digium.com> | 2016-06-30 15:58:53 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2016-07-14 15:59:49 -0500 |
commit | 273052f40498378d3f2d3548347a243df68ee9a4 (patch) | |
tree | 3d959becc0aa82c887a4b70643d5481a5ce7c797 /main/format_cache.c | |
parent | 3cf33dd4e7e886383531335efda3baca728b1f51 (diff) |
Update support for SILK format.
This commit adds scaffolding in order to support the SILK audio format
on calls. Roughly, this is what is added:
* Cached silk formats. One for each possible sample rate.
* ast_codec structures for each possible sample rate.
* RTP payload mappings for "SILK".
In addition, this change overhauls the res_format_attr_silk file in the
following ways:
* The "samplerate" attribute is scrapped. That's native to the format.
* There are far more checks to ensure that attributes have been
allocated before attempting to reference them.
* We do not SDP fmtp lines for attributes set to 0.
These changes make way to be able to install a codec_silk module and
have it actually work. It also should allow for passthrough silk calls
in Asterisk.
Change-Id: Ieeb39c95a9fecc9246bcfd3c45a6c9b51c59380e
Diffstat (limited to 'main/format_cache.c')
-rw-r--r-- | main/format_cache.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/format_cache.c b/main/format_cache.c index def795c9d..b4d426092 100644 --- a/main/format_cache.c +++ b/main/format_cache.c @@ -232,6 +232,14 @@ struct ast_format *ast_format_t140_red; */ struct ast_format *ast_format_none; +/*! + * \brief Built-in "silk" format + */ +struct ast_format *ast_format_silk8; +struct ast_format *ast_format_silk12; +struct ast_format *ast_format_silk16; +struct ast_format *ast_format_silk24; + /*! \brief Number of buckets to use for the media format cache (should be prime for performance reasons) */ #define CACHE_BUCKETS 53 @@ -331,6 +339,10 @@ static void format_cache_shutdown(void) ao2_replace(ast_format_t140_red, NULL); ao2_replace(ast_format_t140, NULL); ao2_replace(ast_format_none, NULL); + ao2_replace(ast_format_silk8, NULL); + ao2_replace(ast_format_silk12, NULL); + ao2_replace(ast_format_silk16, NULL); + ao2_replace(ast_format_silk24, NULL); } int ast_format_cache_init(void) @@ -426,6 +438,14 @@ static void set_cached_format(const char *name, struct ast_format *format) ao2_replace(ast_format_t140, format); } else if (!strcmp(name, "none")) { ao2_replace(ast_format_none, format); + } else if (!strcmp(name, "silk8")) { + ao2_replace(ast_format_silk8, format); + } else if (!strcmp(name, "silk12")) { + ao2_replace(ast_format_silk12, format); + } else if (!strcmp(name, "silk16")) { + ao2_replace(ast_format_silk16, format); + } else if (!strcmp(name, "silk24")) { + ao2_replace(ast_format_silk24, format); } } |