I’ve recently started working on a project for Asterisk to improve performance when it comes to media. Media is an absolute criticial part of the system and it has to be as efficient as possible. The core of this work right now is focusing on how we represent media formats, how they exist within the system, and how they are compared.
The current implementation is an extension of the original ideas and concepts present when Asterisk was created. It has allowed additional codecs to be defined within the core (through modifying code) and attributes to be added to the resulting formats. Unfortunately the cost of this implementation has turned out to be substantial, and thus this take 2 project has come to fruition.
####What will it do different?
- Codecs and formats are separate. This uses less memory since more can be shared.
- Codecs will be defined at run-time and not at compile-time. Any module (or the core itself) will be able to add codecs. Further down the road this could allow codecs and formats to be defined within a configuration file, removing the requirement to write any code.
- Codecs will define all information about a codec in a central spot.
- Formats will internally be as small as possible and reused when possible. This has the benefit of using MUCH less memory (hello embedded systems!).
- Formats will contain all information needed to describe and compare them. This has the benefit of making comparisons fast.
- Format preference will be a part of format capabilities, allowing the core to be smarter in the future.
- Format changes will be signaled at ingress instead of detected along the chain, removing format comparisons.
Putting all of these together gives us a much more performant media format framework with added extensibility.
It’s early days for this project but I have high hopes that the end result will allow users to put more calls onto a machine with some scenarios seeing quite a nice boost.
If you’d like to contribute don’t hesitate to post to the asterisk-dev mailing list or join the #asterisk-dev IRC channel on chat.freenode.net