[asterisk-dev] A thread for format work

Matthew Jordan mjordan at digium.com
Tue Apr 29 07:05:04 CDT 2014

On Tue, Apr 29, 2014 at 6:55 AM, Joshua Colp <jcolp at digium.com> wrote:

> Matthew Jordan wrote:
> <snip>
>  <snip>
>>     The ability to set the framing per-format, globally in a
>>     capabilities structure, and to get the framing already exists. What
>>     doesn't exist is adding a format and then setting the framing as two
>>     separate API calls. That is something that could be added but to
>>     make sure you set the right format (format capabilities can contain
>>     multiple formats of the same codec) you have to keep that format
>>     around, in which case why not just add/set in the same API call?
>> We may end up needing that API call sometime down the road. For example,
>> if an Offer arrives with a new ptime attribute, it may be easier to
>> modify an existing ast_format_cap structure rather than create a new
>> one. But currently I just need the packetization values.
> Since ptime in SIP applies to the media stream (and not to a specific
> media format) you can actually set a global framing value using
> ast_format_cap_set_framing. This applies to all media formats within a
> capabilities structure, unless one is specified for the format explicitly.
Yup. That's why I was thinking that ast_format_cap is the most logical
place to store it.

>  What API call provides them? I must be missing it, because I couldn't
>> seem to find it in format_cap.h. (I could be just going crazy however)
> For getting them you use ast_format_cap_get_framing.
So something like:

    read_ptime0 = ast_format_cap_get_framing(cap0,
    read_ptime1 = ast_format_cap_get_framing(cap1,
    write_ptime0 = ast_format_cap_get_framing(cap0,
    write_ptime1 = ast_format_cap_get_framing(cap1,

My concern here is that the capabilities are obtained from the channel
driver via the get_codec callbacks. I'm not sure that's correct, since the
previous approach got the codecs from the rtp instance via
ast_rtp_instance_get_codecs. However, as that is an AST_VECTOR of
ast_formats, there's not a clean way to turn that into an ast_format_cap.

Do we need a call that turns the vector of formats into a capabilities
structure? Or is what comes back from the get_codecs callback sufficient?

Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140429/3637d793/attachment.html>

More information about the asterisk-dev mailing list