[pjsip] ALSA audio sharing

Damir Arbula damir.arbula at gmail.com
Sat Apr 10 05:26:31 CDT 2010



Problem solved or at least avoided :)


Little change in asound.conf file and audio sharing is working perfect! In
dmix0 slave and dsnoop0 slave these parameters are  added:

rate 16000
period_size 320
buffer_size 10240

If period_size is not equal 320 conference.c line 1792 breaks the program,
and if buffer size is not multiple of 320 then function
snd_pcm_hw_params_set_period_size_near changes period size and program
breaks with same error.


Regards,
Damir


-----Original Message-----
From: Damir Arbula [mailto:damir.arbula at gmail.com] 
Sent: Saturday, April 10, 2010 12:35 AM
To: 'pjsip at lists.pjsip.org'
Subject: ALSA audio sharing



Little update on the problem: it seems that reason for auddemo working with
virtual alsa devices and pjsua not working lies in pjsua's use of conference
bridge. If pjsua use real device hw:0,0 there is no problem but also no
sharing possibility. If it uses virtual device then function
snd_pcm_hw_params_set_period_size_near in alsa_dev.c (line 562, 678) changes
the period size parameter from 320 to 2000 which (presumably) somehow result
in conflict in conference bridge (line 1792). 


I did not have enough time and more important skill (not a programmer) to
look into this problem but my long shot attempt would be to say that if alsa
virtual devices are going to be used in pjsip then something in conference
bridge has to be adjusted?


Regards,
Damir


------------------------------

Date: Thu, 8 Apr 2010 15:14:29 +0200
From: "Damir Arbula" <damir.arbula at gmail.com>
To: <pjsip at lists.pjsip.org>


Hi,


is there a way to get the trunk version with native ALSA support to work in
audio device sharing mode (defined in asound.conf). Auddemo is working,
record and play are working with audio device being busy in other process
but when I try pjsua it breaks after I try to make a call on line 1792,
conference.c: 
get frame: Assertion 'frame->size == conf->samples_per_frame *
conf->bits_per_sample / 8' failed


Thank you,
Damir

P.S. Below are the alsa_dev.c change and asound.conf

alsa_dev.c:
/*#define ALSA_DEVICE_NAME 		"plughw:%d,%d"*/
#define ALSA_DEVICE_NAME 		"pasym0"

asound.conf:
pcm.card0 {
  type hw
  card 0
}
pcm.dmix0 {
  type dmix
  ipc_key 34521
  slave {
    pcm "card0"
  }
}
pcm.dsnoop0 {
  type dsnoop
  ipc_key 34521
  slave {
    pcm "card0"
  }
}
pcm.asym0 {
  type asym
  playback.pcm "dmix0"
  capture.pcm "dsnoop0"
}
pcm.pasym0 {
  type plug
  slave.pcm "asym0"
}
pcm.dsp0 {
  type plug
  slave.pcm "asym0"
}
ctl.dsp0 {
  type hw
  card 0
}
pcm.!default {
  type plug
  slave.pcm "asym0"
}
ctl.!default {
  type hw
  card 0
}




More information about the pjsip mailing list