[Home]

Summary:ASTERISK-23957: Media format improvements: implement attribute caching
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2014-06-26 19:26:16Date Closed:2014-07-09 12:53:01
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/General Core/RTP Resources/res_format_attr_celt Resources/res_format_attr_h263 Resources/res_format_attr_h264 Resources/res_format_attr_silk
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Format attributes are still not implemented fully in the new media format architecture branch ({{team/group/media_formats-reviewed-trunk}}). There are a few considerations that have been uncovered that will require changes to the existing format API:
# Attributes are mutable. They are typically generated from an SDP, or explicitly via a {{set}} call. The attributes must be stored in an object provided by the various attribute resource modules, and must be associated with the format from the RTP instance.
# Formats are immutable. In many ways, this contradicts the first point - you cannot store an attribute object provided by a resource module on an immutable object.

The way this should be handled is as follows:
* Any operation that modifies an attribute (either through an SDP or by an explicit {{set}} call) must return a new {{ast_format}} object. The caller of the function is responsible for re-storing the new {{ast_format}} object in the appropriate locations.
* An operation that creates a new {{ast_format}} object should clone the format; retrieve the attributes that are currently in the format, and update the attributes appropriately. Attributes can be mutable if desired; however, that is implementation specific in the resource modules themselves.

To support this, the format API should be changed as follows:
# The {{format_attribute_set}} callback and {{format_sdp_parse}} callback on the {{ast_format_interface}} should be changed to return a new {{ast_format}} object. The {{struct ast_format}} passed into these functions should be made {{const}}.
# The {{format}} API should provide a new function, {{ast_format_clone}}. This should return a new {{struct ast_format}} that is a deep copy of a passed in {{const struct ast_format}}.
# The {{ast_format_interface}} should provide a {{format_clone}} callback called by {{ast_format_clone}}. This should instruct the {{ast_format_interface}} implementation to copy the attributes in the private {{void *}}.

Once these modifications are made, the various Resource modules can be updated with the new callbacks.
Comments: