[asterisk-dev] Media Formats: ast_best_codec and cached formats questions

Matthew Jordan mjordan at digium.com
Sun Jun 22 10:08:25 CDT 2014


On Sun, Jun 22, 2014 at 9:46 AM, Joshua Colp <jcolp at digium.com> wrote:
> Matthew Jordan wrote:
>>
>> A few questions for those working on the media format improvements:
>>

<snip>

>> 2) Cached formats: who is supposed to define these things? Thanks to
>> Corey's patches compilation succeeds, but linking fails big time. I'm
>> not sure where/who the creator of these structures is supposed to be.
>
>
> I don't think anything, yet. Something in the core should though.
>

There's something of a chicken & egg problem here.

We can't generate a format properly until we have the codec. Those
codecs are loadable modules: they may be present, they may not ever be
present. And they may load late in the startup sequence.

The only thing I can think of doing is:

(1) Have format_cache create the cached formats, but initialize them
to a 'bogus' codec. If they ever get used without the codec being
loaded, this will keep things from crashing but will result in an
error of some kind.

(2) As the formats/codecs load, they should register themselves with
the cache. If they provide a cached format, swap out the bogus codec
with a real one.

(3) On shutdown, clean up the cached formats.

I'll have to play around with this some, but the idea of a 'fake'
codec or 'fake' format holding the place of the real one until it is
loaded feels like the safest way to keep things from blowing up.

-- 
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



More information about the asterisk-dev mailing list