PJSUA(python) audio problem with multiple devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a problem with using multiple sound devices and the pjsua python module.
In order to use multiple devices I added a function to the python wrapper to add audio devices using the pjmedia library.
Now everything works great, the first audio device is maintained by pjsua and the others by pjmedia. But on a certain moment especially when I use the micro all the sound devices stop working. And in the pjsip log I do not find any error. What could be the problem, my code, the pjsip library or maybe pulseaudio? I use pjproject-2.0.1.
This is the function that I added in _pjsua.c:

static PyObject *py_pjsua_add_snd_port(PyObject *pSelf, PyObject *pArgs)
{
    int m_id;
    int p_id;
    static pj_caching_pool cp;
    pjmedia_snd_port *sndport;
    pj_status_t status = 0;
    pjmedia_port *splitcomb;
    pj_pool_t *pool = NULL;
    int sample_rate = 8000;
int channel_count = 1;
int ptime = 15;
int samples_per_frame = sample_rate * ptime * channel_count / 1000;

    PJ_UNUSED_ARG(pSelf);
    PJ_UNUSED_ARG(pArgs);
    if (!PyArg_ParseTuple(pArgs, "ii", &m_id, &p_id)) {
        return NULL;
    }

pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
pool = pj_pool_create(&cp.factory, "snddevtmp", POOL_SIZE, POOL_SIZE, NULL);
status = pjmedia_snd_port_create(pool, /* memory pool */
                                                                              m_id, /* rec id */
                                                                              p_id, /* play id */
                                                                              sample_rate, /* sampling rate */
                                                                              channel_count, /* # of channels */
                                                                              samples_per_frame, /* samples per frame */
                                                                              16, /* bits per sample */
                                                                              0, /* options */
                                                                              &sndport);
                if (status != 0)
                               return Py_BuildValue("ii", status, 0);

                status = pjmedia_splitcomb_create(pool, /* memory pool */
                                                                              sample_rate, /* sampling rate */
                                                                              channel_count, /* # of channels */
                                                                              samples_per_frame, /* samples per frame */
                                                                              16, /* bits per sample */
                                                                              0, /* options */
                                                                              &splitcomb);
                if (status != 0)
                               return Py_BuildValue("ii", status, 0);

                pjmedia_port *revch;
                status = pjmedia_splitcomb_create_rev_channel(pool, splitcomb, 0, 0, &revch);
                if (status != 0)
                               return Py_BuildValue("ii", status, 0);

                int slot;
                status = pjsua_conf_add_port(pool, revch, &slot);
                if (status != 0)
                               return Py_BuildValue("ii", status, 0);

                status = pjmedia_snd_port_connect(sndport, splitcomb);

    return Py_BuildValue("ii", status, slot);
}




#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by Mailsecurity software
#####################################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130412/aadadb9d/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux