diff --git a/res/res_format_attr_opus.c b/res/res_format_attr_opus.c index 3de1af38652854ddb15ec787195ba88006368567..7748ecc92a41f86ac6785a1e74fbc4164ce5d98a 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 365cacc428a079cae5878b31f80256e08e33e398..3a8ca60d2dcc6aa65396c6e9b9064311b4ea92cb 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)