format: Register format-attribute module with cached formats.

In Asterisk 13, cached formats are created before their corresponding format-
attribute module is registered. Cached formats are involved when a local
extension is called. Therefore, ast_format_generate_sdp_fmtp did not work
on local extensions. This change affects the Opus Codec, H.263 (Plus), H.264,
and format-attribute modules provided externally.

ASTERISK-25160 #close

Change-Id: I1ea1f0483e5261e2a050112e4ebdfc22057d1354
changes/00/1600/3
Alexander Traud 10 years ago
parent e4af14784e
commit fd23d423d8

@ -302,6 +302,14 @@ const void *ast_format_attribute_get(const struct ast_format *format, const char
{
const struct ast_format_interface *interface = format->interface;
if (!interface) {
struct format_interface *format_interface = ao2_find(interfaces, format->codec->name, OBJ_SEARCH_KEY);
if (format_interface) {
interface = format_interface->interface;
ao2_ref(format_interface, -1);
}
}
if (!interface || !interface->format_attribute_get) {
return NULL;
}
@ -330,11 +338,21 @@ struct ast_format *ast_format_parse_sdp_fmtp(const struct ast_format *format, co
void ast_format_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
{
if (!format->interface || !format->interface->format_generate_sdp_fmtp) {
const struct ast_format_interface *interface = format->interface;
if (!interface) {
struct format_interface *format_interface = ao2_find(interfaces, format->codec->name, OBJ_SEARCH_KEY);
if (format_interface) {
interface = format_interface->interface;
ao2_ref(format_interface, -1);
}
}
if (!interface || !interface->format_generate_sdp_fmtp) {
return;
}
format->interface->format_generate_sdp_fmtp(format, payload, str);
interface->format_generate_sdp_fmtp(format, payload, str);
}
struct ast_codec *ast_format_get_codec(const struct ast_format *format)

Loading…
Cancel
Save