]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
rtp_engine: Init a format-attribute module to its RFC defaults. 93/1593/2
authorAlexander Traud <pabstraud@compuserve.com>
Tue, 10 Nov 2015 15:27:57 +0000 (16:27 +0100)
committerAlexander Traud <pabstraud@compuserve.com>
Wed, 11 Nov 2015 13:58:47 +0000 (14:58 +0100)
Previously, format-attribute modules relied on an existing fmtp line in SDP
negotiation. However, fmtp is optional for several formats like the Opus Codec.
Now, the format-attribute module is called with an empty fmtp, which allows the
module to initialise itself to RFC defaults. Furthermore now, Asterisk is able
to differentiate between internally and externally created formats.

ASTERISK-25537 #close

Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52

main/rtp_engine.c

index 8ad3d9e776e8464e60661bebe884733e3baf68c6..57a3ef354aac650bbc1948cb27bb1d482d62e530 100644 (file)
@@ -727,9 +727,13 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
                new_type->rtp_code = t->payload_type.rtp_code;
                if ((ast_format_cmp(t->payload_type.format, ast_format_g726) == AST_FORMAT_CMP_EQUAL) &&
                                t->payload_type.asterisk_format && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
-                       new_type->format = ao2_bump(ast_format_g726_aal2);
+                       new_type->format = ast_format_g726_aal2;
                } else {
-                       new_type->format = ao2_bump(t->payload_type.format);
+                       new_type->format = t->payload_type.format;
+               }
+               if (new_type->format) {
+                       /* SDP parsing automatically increases the reference count */
+                       new_type->format = ast_format_parse_sdp_fmtp(new_type->format, "");
                }
                AST_VECTOR_REPLACE(&codecs->payloads, pt, new_type);