High CPU usage with two sound device

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

 



Hi,

I want to add a second sound device to conference bridge.
When I create only first device the cpu is  1%
When I create two devices the cpu is 100%
Where is the error?

This is the code

    {
        printf("first device\n");
        //Set sound device
        status =pjsua_set_snd_dev(3,2);

        if (status != PJ_SUCCESS) {
            _LOG(MAIN_LOG,FATAL_DEBUG_LEVEL,"Error in
pjsua_set_snd_dev()\r\n");
            return;
        }
        pjsua_conf_disconnect(0,0);
    }

    //sound device
    {
        printf("second device\n");
        pjmedia_snd_port       *snd;
        pjmedia_port       *sc, *sc_ch1;
        pjsua_conf_port_id        sc_ch1_slot;
        pjsua_conf_port_info  masterPortInfo;

        //get info about master conference port
        status = pjsua_conf_get_port_info( 0, &masterPortInfo );
        if (status != PJ_SUCCESS) {
            printf("Error while reading master port info\n");
        }

        //pjmedia_port *conf;
        pj_status_t status;

        //Disable existing sound device
        //conf = pjsua_set_no_snd_dev();
        // Create sound device

        printf("create %d %d %d %d\n",
                masterPortInfo.clock_rate,
                1       ,
                1 * masterPortInfo.samples_per_frame,
                masterPortInfo.bits_per_sample);

        status = pjmedia_snd_port_create(pool,4,1,
                masterPortInfo.clock_rate,
                1,
                1 * masterPortInfo.samples_per_frame,
                masterPortInfo.bits_per_sample,
                0, &snd);
        pj_assert(status == PJ_SUCCESS);


        // Create stereo-mono splitter/combiner
        status = pjmedia_splitcomb_create(pool,
                masterPortInfo.clock_rate, // clock rate
                1,
                1 * masterPortInfo.samples_per_frame,
                masterPortInfo.bits_per_sample,
                0,
                &sc);
        pj_assert(status == PJ_SUCCESS);

        // Create reverse channel
        status = pjmedia_splitcomb_create_rev_channel(pool,
                              sc,
                              0,
                              0,  // options
                              &sc_ch1);
        pj_assert(status == PJ_SUCCESS);

        // .. and register it to conference bridge (it would be slot1
        // if there's no other devices connected to the bridge)

        status = pjsua_conf_add_port(pool, sc_ch1, &sc_ch1_slot);
        pj_assert(status == PJ_SUCCESS);


        // Connect the splitter to the sound device
        status = pjmedia_snd_port_connect(snd, sc);
        printf("connect\n");
        pj_assert(status == PJ_SUCCESS);
        //pjsua_conf_disconnect(sc_ch1_slot,sc_ch1_slot);
        pjsua_conf_disconnect(1,1);

    }




Thanks

Santiago Blanco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20131011/9fec0885/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