diff options
author | Sean Bright <sean@malleable.com> | 2015-01-28 12:18:14 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2015-01-28 12:18:14 +0000 |
commit | c3add776af2fc339de0c07f336d8b6eb9d55d062 (patch) | |
tree | 0bb0170a8fca8347b78541656afa783e674eb4d6 | |
parent | 88fbe4e91764320e865a8a39b309821697d84b53 (diff) |
media formats: update res_format_attr_opus & silk
In r419044, we changed how formats were handled, but the return value
of the format_parse_sdp_fmtp functions in res_format_attr_opus and
res_format_attr_silk were not updated, causing calls to fail. Ran
into this when getting codec_opus working with Asterisk 13.
Once the return value was corrected, we were crashing in opus_getjoint
because of NULL format attributes. I've fixed this as well in this
patch.
Review: https://reviewboard.asterisk.org/r/4371/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/res_format_attr_opus.c | 16 | ||||
-rw-r--r-- | res/res_format_attr_silk.c | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/res/res_format_attr_opus.c b/res/res_format_attr_opus.c index 3de1af386..7748ecc92 100644 --- a/res/res_format_attr_opus.c +++ b/res/res_format_attr_opus.c @@ -51,6 +51,12 @@ struct opus_attr { unsigned int spropstereo; /* Default 0 */ }; +static struct opus_attr default_opus_attr = { + .fec = 0, + .dtx = 0, + .stereo = 0, +}; + static void opus_destroy(struct ast_format *format) { struct opus_attr *attr = ast_format_get_attribute_data(format); @@ -120,7 +126,7 @@ static struct ast_format *opus_parse_sdp_fmtp(const struct ast_format *format, c attr->dtx = val; } - return 0; + return cloned; } static void opus_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str) @@ -163,6 +169,14 @@ static struct ast_format *opus_getjoint(const struct ast_format *format1, const struct ast_format *jointformat; struct opus_attr *attr_res; + if (!attr1) { + attr1 = &default_opus_attr; + } + + if (!attr2) { + attr2 = &default_opus_attr; + } + jointformat = ast_format_clone(format1); if (!jointformat) { return NULL; diff --git a/res/res_format_attr_silk.c b/res/res_format_attr_silk.c index 365cacc42..3a8ca60d2 100644 --- a/res/res_format_attr_silk.c +++ b/res/res_format_attr_silk.c @@ -94,7 +94,7 @@ static struct ast_format *silk_parse_sdp_fmtp(const struct ast_format *format, c attr->fec = val; } - return 0; + return cloned; } static void silk_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str) |