Connecting ALSA device to Conference Bridge: How?

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

 



Hi Brian,

The -1 and -2 are legit, pjsip uses those values to refer to default 
devices. Your test code is probably getting an error returned from 
pjsua_set_snd_dev, but then overwriting it with success (0) when you 
call pjsua_get_snd_dev and it returns those default values. I would also 
remove the call to snd_pcm_open and let pjmedia do it. Note that pjmedia 
will iterate over various sampling rates to find one the device likes.

Regards,

Bill

On 2/27/2015 1:51 PM, Brunner, Brian T. wrote:
> First: Many thanks for the help so far.
>
> Now: I cannot find, in documentation or example/source code, how to 
> connect a hardware device to the conference bridge.  Disk files (to 
> players) and network connections (to recorders) works fine.
>
> My log shows that I have Alsa linked in and that Alsa can find the 
> desired device:
> 11:05:51.849     alsa_dev.c  ..Added sound device 
> default:CARD=imx6qqmx6sgtl50
> 11:05:51.853     alsa_dev.c  ..Added sound device 
> sysdefault:CARD=imx6qqmx6sgtl50
> 11:05:51.881     alsa_dev.c  ..ALSA driver found 2 devices
> 11:05:51.881     alsa_dev.c  ..ALSA initialized.
>
> aplay -l shows
> **** List of PLAYBACK Hardware Devices ****
> card 0: imx6qqmx6sgtl50 [imx6q-qmx6-sgtl5000], device 0: HiFi 
> sgtl5000-0 []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 1: imxhdmisoc [imx-hdmi-soc], device 0: i.MX HDMI Audio Tx 
> hdmi-hifi-0 []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
>
> My source code:
>     int NumDevs = pjmedia_aud_dev_count();
>     printf("Getting %d Snd Devs\n", NumDevs);
>     pjmedia_aud_dev_info *AudDevInfo;
>     snd_pcm_t **PCMPlaybackHandle;
>     AudDevInfo = 
> (pjmedia_aud_dev_info*)calloc(NumDevs,sizeof(pjmedia_aud_dev_info));
>     PCMPlaybackHandle = (snd_pcm_t**)calloc(NumDevs, sizeof(void *));
>     int iLoop;
>     for (iLoop = 0; iLoop < NumDevs; iLoop++)
>     {
>         status = pjmedia_aud_dev_get_info(iLoop, &AudDevInfo[iLoop]);
>         printf("%d: %s (in=%d, out=%d)\n", iLoop, 
> AudDevInfo[iLoop].name, AudDevInfo[iLoop].input_count, 
> AudDevInfo[iLoop].output_count);
>         printf("Opening %s\n", AudDevInfo[iLoop].name);
>         status = snd_pcm_open ( &PCMPlaybackHandle[iLoop], 
> AudDevInfo[iLoop].name, SND_PCM_STREAM_PLAYBACK, 0);
>         status = pjsua_set_snd_dev(LV.HWmic,LV.HWdsp);        // 
> Device IDs from ??? (these are both zero)
>         printf("Sound devices set, now to get\n");
>         status = pjsua_get_snd_dev(&LV.HWmic,&LV.HWdsp);    // Device 
> IDs from ??? (these are -1 and -2)
>         char buf[1024];
>         pj_str_t PjStr = pj_strerror (status, buf, 1024);
>         PJ_LOG(3,(__FILE__,"%s pjsua_get_snd_dev returned %d(%.*s) mic 
> %d dsp %d", __FUNCTION__, status, PjStr.slen, PjStr.ptr, LV.HWmic, 
> LV.HWdsp));
>     }
>     LV.DSPConfPort        = pjsua_player_get_conf_port(LV.HWdsp);
>
> results in this output:
> Getting 2 Snd Devs
> 0: default:CARD=imx6qqmx6sgtl50 (in=1, out=1)
> Opening default:CARD=imx6qqmx6sgtl50
> 13:50:08.690    pjsua_aud.c  Set sound device: capture=0, playback=0
> 13:50:08.690 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.690    pjsua_aud.c  .Opening sound device PCM at 16000/1/20ms
> 13:50:08.690     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.692     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.692 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.693    pjsua_aud.c  .Opening sound device PCM at 44100/1/20ms
> 13:50:08.693     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.695     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.695 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.695    pjsua_aud.c  .Opening sound device PCM at 48000/1/20ms
> 13:50:08.695     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.697     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.697 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.697    pjsua_aud.c  .Opening sound device PCM at 32000/1/20ms
> 13:50:08.698     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.699     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.700 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.700    pjsua_aud.c  .Opening sound device PCM at 16000/1/20ms
> 13:50:08.700     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.702     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.702 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.702    pjsua_aud.c  .Opening sound device PCM at 8000/1/20ms
> 13:50:08.702     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.704     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.704    pjsua_aud.c  .Unable to open sound device: Unknown 
> error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002]
> Sound devices set, now to get
> 13:50:08.705 /home/advance/  main pjsua_get_snd_dev returned 
> 0(Success) mic -1 dsp -2
> 1: sysdefault:CARD=imx6qqmx6sgtl50 (in=1, out=1)
> Opening sysdefault:CARD=imx6qqmx6sgtl50
> 13:50:08.706     alsa_dev.c  ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.707    pjsua_aud.c  Set sound device: capture=-1, playback=-2
> 13:50:08.707 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.707    pjsua_aud.c  .Opening sound device PCM at 16000/1/20ms
> 13:50:08.707     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.709     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.709 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.709    pjsua_aud.c  .Opening sound device PCM at 44100/1/20ms
> 13:50:08.709     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.711     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.712 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.712    pjsua_aud.c  .Opening sound device PCM at 48000/1/20ms
> 13:50:08.712     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.714     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.714 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.714    pjsua_aud.c  .Opening sound device PCM at 32000/1/20ms
> 13:50:08.714     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.716     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.716 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.716    pjsua_aud.c  .Opening sound device PCM at 16000/1/20ms
> 13:50:08.716     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.718     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.719 /home/advance/  .cb_on_snd_dev_operation, Opening
> 13:50:08.719    pjsua_aud.c  .Opening sound device PCM at 8000/1/20ms
> 13:50:08.719     alsa_dev.c  ..open_playback: Open playback device 
> 'default:CARD=imx6qqmx6sgtl50'
> 13:50:08.721     alsa_dev.c  ..ALSA lib 
> /home/advance/fsl-community-bsp/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/alsa-lib/1.0.27.2-r0/alsa-lib-1. 
>
> 13:50:08.721    pjsua_aud.c  .Unable to open sound device: Unknown 
> error from audio driver (PJMEDIA_EAUD_SYSERR) [status=420002]
> Sound devices set, now to get
> 13:50:08.721 /home/advance/  main pjsua_get_snd_dev returned 
> 0(Success) mic -1 dsp -2
> EleVoIP: ../src/pjsua-lib/pjsua_aud.c:1195: 
> pjsua_player_get_conf_port: Assertion 
> `id>=0&&id<(int)(sizeof(pjsua_var.player)/sizeof(pjsua_var.player[0]))' failed. 
>
>
> It appears that the -1 and -2 are not legit.
>
> Clues, tips, pointers, etc. greatly appreciated.
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------------------------------------------------------------- 
>
>
> Confidentiality Requirement: This communication, including any 
> attachment(s), may contain confidential information and is for the 
> sole use of the intended recipient(s). If you are not the intended 
> recipient, you are hereby notified that you have received this 
> communication in error and any unauthorized review, use, disclosure, 
> dissemination, distribution or copying of it or its contents is 
> strictly prohibited.  If you have received this communication in 
> error, please notify the sender immediately by telephone or e-mail and 
> destroy all copies of this communication and any attachments.
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20150227/f4e23fb2/attachment.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