[Freeswitch-dev] mod_portaudio multiple endpoints support

Mitch Capper mitch.capper at gmail.com
Thu May 26 21:37:51 MSD 2011


Hi Moy,
First of all I wanted to thank you and Comrex for the new improvements
and code you have done I think a lot of people will find these
features very useful!
Thanks for clarifying some things on IRC.   The changes look good my
main concerns with the current code are how well it reacts to dynamic
changes (usb devices plugged or unplugged)  and the fact all streams
and endpoints have to be specified in the xml config itself.
I am not sure if there is a large reason to have endpoints that are
defined separately from streams.  An endpoint is just a name, a the
indev, the outdev, and the channel for each.  Streams already define
an indev and outdev which makes things a bit confusing.   If channel
selection was moved to the stream definition it could all be defined
there.    The only downside to this that I see is when you have an
audio device with multiple channels you are going to end up
duplicating the stream section partially for each but I am not sure if
that is enough to warrant to require the double configuration of an
audio device before you can start using it.   I would say that if the
device selection was expanded so that rather than just a device ID
/name to also include the channel I think it would be an improved
interface.

Short of that I think before it is merged into trunk the changes
should be merged in a bit better with the existing commands and the
existing stream code should be merged with the shared stream code as
right now some functionality is being duplicated.   While the way the
changes were made looks like relatively few new code paths are
followed if you don't use the new shared streams/endpoints, it makes
for a confusing interface for someone trying to figure out how things
work.

My suggested list of changes would be:
-Merge the existing stream code with the new stream code, this should
eliminate some of the redundancies and allow the new code to be used
everywhere, streams would be expanded to have the naming, channels,
rates, and other features that shared streams allow
-Ability to create streams through the API (with the merge of the
above code its just expanding the API to take the additional params)
-Remove endpoints and allow bridging directly to a stream by using the
stream's name
-Do not validate streams until you go to use them, right now if a
device is not ready when the xml config is read you can't use it
-pa answer, pa call, pa play  are expanded to optionally take the
streamname to act on
-pa switchstream takes the call to switch the stream on
-pa switch this is a tougher one but would need to figure something else out
-Checks to make sure a specific device input is not already in use
prior to use it for input or output by a stream, this needs to go a
step further than just making sure a specific stream isn't used
multiple times as multiple streams could use the same device and I
have found this rarely works out


Many of the changes are just to make portaudio a bit more aware and
capable of multi-active call multi-device support and allowing
anything to be specified dynamically.   It will be important to also
do it in such a way that someone can still use the functions without
inadvertently enabling multiple active calls when they are only
looking to use one device.

I think it will probably be a decent bit of work to do these things
but should allow for the great new features you have added without
causing confusion for other users.   By all means I am not asking you
do this work any time someone contributes code back to FS its great
and something much appreciated and certainly others can work to fully
integrate it into freeswitch.  I figured I would just give some other
feedback about it as you asked for comments.   I will try and test it
on windows sometime shortly also for compatibility there but again
thanks to you and Comrex for the new feature and I am sure it took
some real work to ensure full backwards compatibility.

My 2c.

~Mitch


On Wed, May 25, 2011 at 10:20 PM, Moises Silva <moises.silva at gmail.com> wrote:
> Hello,
> I've been doing some changes to mod_portaudio sponsored by Comrex
> Corporation. The changes involve adding support for using multiple audio
> devices simultaneously, including devices with multiple channels (note that
> is not exactly the same as stereo).



More information about the FreeSWITCH-dev mailing list