Poor audio quality with splitter combiner

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

 



Hello,

 

I am working on a project on an embedded linux device running RHEL7 where two calls are established with PJSIP, each with a seperate mono audio stream at 8kHz. We want one call to be routed to the left channel of our audio device and the other call to go to the right channel. To accomplish this, we created a splitter/combiner as per the stereo example in the pjsua program. However, when setting up audio this way, we see a lot of problems. We see very high jitter values on the TX side of the calls, 1500-2000 msec. Perhaps because of this, the incoming audio is very distorted in both the left and right channel. The left channel sounds low and garbled, and has a latecy of around 1 second. The right channel is also garbled, but can be understood and sounds like it is at a higher pitch. Below is a portion of the logs showing the audio issue:

 

               09:22:00.612     scombdb-up !Underflow, buf_cnt=0, will generate 1 frame

               09:22:00.682     scombdb-dn !304 samples reduced, buf_cnt=1206

               09:22:00.682     scombdb-dn  Buffer size adjusted from 1510 to 1206 (eff_cnt=960)

               09:22:00.697     scombdb-up !Underflow, buf_cnt=0, will generate 1 frame

               09:22:00.767     scombdb-dn !336 samples reduced, buf_cnt=1190

               09:22:00.767     scombdb-dn  Buffer size adjusted from 1526 to 1190 (eff_cnt=960)

               09:22:00.782     scombdb-up !Underflow, buf_cnt=0, will generate 1 frame

               09:22:00.847     scombdb-up  Underflow, buf_cnt=0, will generate 1 frame

               09:22:00.851      scomb-rev !Pausing media flow on downstream direction (level=14)

               09:22:00.888      scomb-rev !Resuming media flow on downstream direction (level=13)

               09:22:00.932      scomb-rev  Pausing media flow on upstream direction (level=-14)

               09:22:00.975      scomb-rev  Resuming media flow on upstream direction (level=-13)

               09:22:01.001     scombdb-dn !403 samples reduced, buf_cnt=1427

               09:22:01.002     scombdb-dn  Buffer size adjusted from 1830 to 1427 (eff_cnt=960)

               09:22:01.017     scombdb-up !Underflow, buf_cnt=0, will generate 1 frame

               09:22:01.087     scombdb-dn !235 samples reduced, buf_cnt=1512

 

Below is the code used to connect the audio device to the conference bridge via the splitcomb:

 

               #define LEFT_CH 0

               #define RIGH_CH 1

               #define NO_OPT 0

              

               // Set up any variables

               pjmedia_port *conf;

               pj_pool_t* splitterPool;

               splitterPool = pjsua_pool_create("splitterPool", 512, 512);

               pjmedia_port *splitcomb;

               pjmedia_port *revChPort;

               pjsua_conf_port_id rightPortId;

               pjmedia_snd_port *sndDevPort;

 

               /* Disable existing sound device and get conf master port.*/

               conf = pjsua_set_no_snd_dev();

 

               /* Create stereo-mono splitter/combiner */

               status = pjmedia_splitcomb_create(splitterPool,

                                                            PJMEDIA_PIA_SRATE(&conf->info) /* clock rate */,

                                                            2                 /* stereo */,

                                                            2 * PJMEDIA_PIA_SPF(&conf->info),

                                                            PJMEDIA_PIA_BITS(&conf->info),

                                                            0                 /* options */,

                                                            &splitcomb);

               pj_assert(status == PJ_SUCCESS);

 

               /* Connect channel0 (left channel?) to conference port slot0 */

               status = pjmedia_splitcomb_set_channel(splitcomb, LEFT_CH, NO_OPT, conf);

               pj_assert(status == PJ_SUCCESS);

 

               /* Create reverse channel for channel1 (right channel?)... */

               status = pjmedia_splitcomb_create_rev_channel(splitterPool, splitcomb, RIGHT_CH, NO_OPT, &revChPort);

               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(splitterPool, revChPort, &rightPortId);

               pj_assert(status == PJ_SUCCESS);

 

               /* Create sound device */

               status = pjmedia_snd_port_create(splitterPool, devId, devId, // devId is set to the correct value before this.

                                                                           PJMEDIA_PIA_SRATE(&conf->info),

                                                                           2                 /* stereo */,

                                                                           2 * PJMEDIA_PIA_SPF(&conf->info),

                                                                           PJMEDIA_PIA_BITS(&conf->info),

                                                                           NO_OPT,

                                                                           &sndDevPort);

               pj_assert(status == PJ_SUCCESS);

              

               /* Connect the splitter to the sound device */

               status = pjmedia_snd_port_connect(sndDevPort, splitcomb);

               pj_assert(status == PJ_SUCCESS);

              

When calls are made we then call pjsua_conf_connect(callId1, LEFT_CH) and pjsua_conf_connect(callId2, RIGHT_CH) for the respective calls.

 

Is there any step missing in the above code to set up the splitter/combiner? Do the audio logs shown above indicate a specific problem?

 

What I've done so far: I have tried adjusting the values used for pjmedia_splitcomb_create(...) and pjmedia_snd_port_create(...) manually, but audio quality did not improve. I also disbaled AEC with no improvement. The processor sits at 90% idle according to top.

 

Thanks,

John


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[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