C – как разрешить эту ошибку при использовании pjsip?

Я получаю эту ошибку при использовании pjsip. Как это решить? У меня есть микрофон / динамик в системе, но он не может получить устройство.

http://paste.ubuntu.com/6504337/

/* Create audio device parameter to open the device */ static pj_status_t create_aud_param(pjmedia_aud_param *param, pjmedia_aud_dev_index capture_dev, pjmedia_aud_dev_index playback_dev, unsigned clock_rate, unsigned channel_count, unsigned samples_per_frame, unsigned bits_per_sample) { pj_status_t status; /* Normalize device ID with new convention about default device ID */ if (playback_dev == PJMEDIA_AUD_DEFAULT_CAPTURE_DEV) playback_dev = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV; /* Create default parameters for the device */ status = pjmedia_aud_dev_default_param(capture_dev, param); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Error retrieving default audio " "device parameters", status); return status; } param->dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; param->rec_id = capture_dev; param->play_id = playback_dev; param->clock_rate = clock_rate; param->channel_count = channel_count; param->samples_per_frame = samples_per_frame; param->bits_per_sample = bits_per_sample; /* Update the setting with user preference */ #define update_param(cap, field) \ if (pjsua_var.aud_param.flags & cap) { \ param->flags |= cap; \ param->field = pjsua_var.aud_param.field; \ } update_param( PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING, input_vol); update_param( PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING, output_vol); update_param( PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE, input_route); update_param( PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE, output_route); #undef update_param /* Latency settings */ param->flags |= (PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY | PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY); param->input_latency_ms = pjsua_var.media_cfg.snd_rec_latency; param->output_latency_ms = pjsua_var.media_cfg.snd_play_latency; /* EC settings */ if (pjsua_var.media_cfg.ec_tail_len) { param->flags |= (PJMEDIA_AUD_DEV_CAP_EC | PJMEDIA_AUD_DEV_CAP_EC_TAIL); param->ec_enabled = PJ_TRUE; param->ec_tail_ms = pjsua_var.media_cfg.ec_tail_len; } else { param->flags &= ~(PJMEDIA_AUD_DEV_CAP_EC|PJMEDIA_AUD_DEV_CAP_EC_TAIL); } /* VAD settings */ if (pjsua_var.media_cfg.no_vad) { param->flags &= ~PJMEDIA_AUD_DEV_CAP_VAD; } else { param->flags |= PJMEDIA_AUD_DEV_CAP_VAD; param->vad_enabled = PJ_TRUE; } return PJ_SUCCESS; } 

ОШИБКА:

 14:13:41.786 pjsua_aud.c ..Error retrieving default audio device parameters: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) [status=420006] Exception: Object: {Account }, operation=make_call(), error=Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) 

РЕДАКТИРОВАТЬ:

Убедитесь, что у моей системы есть устройство воспроизведения и захвата или нет (как вы можете видеть, следующие шоу показывают, что 100% работает без pjsip):

 sun@sun-M14xR2:/var/tmp/pjproject-2.1.0/pjsip/src/pjsua-lib$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: CA0132 Analog [CA0132 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] Subdevices: 0/1 Subdevice #0: subdevice #0 card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 sun@sun-M14xR2:/var/tmp/pjproject-2.1.0/pjsip/src/pjsua-lib$ cat /proc/asound/cards 0 [PCH ]: HDA-Intel - HDA Intel PCH HDA Intel PCH at 0xd2710000 irq 47 1 [NVidia ]: HDA-Intel - HDA NVidia HDA NVidia at 0xd1000000 irq 17 2 [U0x46d0x825 ]: USB-Audio - USB Device 0x46d:0x825 USB Device 0x46d:0x825 at usb-0000:00:14.0-4, high speed sun@sun-M14xR2:/var/tmp/pjproject-2.1.0/pjsip/src/pjsua-lib$ gst-launch-0.10 -v alsasrc device=hw:2 ! audioresample ! audio/x-raw-int,rate=48000 ! autoaudiosink Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: actual-buffer-time = 200000 /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: actual-latency-time = 10000 /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0.GstPad:src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstAudioSrcClock /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse.GstPad:sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0.GstGhostPad:sink: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000, channels=(int)1 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse: volume = 1.000000 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse: mute = FALSE /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse: volume = 1.000000 /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse: mute = FALSE WARNING: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Can't record audio fast enough Additional debug info: gstbaseaudiosrc.c(840): gst_base_audio_src_create (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Dropped 10560 samples. This is most likely because downstream can't keep up and is consuming samples too slowly. WARNING: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Can't record audio fast enough Additional debug info: gstbaseaudiosrc.c(840): gst_base_audio_src_create (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Dropped 9600 samples. This is most likely because downstream can't keep up and is consuming samples too slowly. 

    Ваша проблема связана с аудиосистемой. Большинство Linux-систем запускают PulseAudio поверх Alsa , как и ваши (вы можете видеть это в журналах GStreamer), но по умолчанию pjsip включает драйвер PortAudio для Linux.

    Чтобы исправить это, вы можете включить ansible драйвер Alsa, добавив:

     #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 #define PJMEDIA_AUDIO_DEV_HAS_ALSA 1 

    Для pjlib / include / pj / config_site.h. Если он не существует, вы можете создать его так:

     #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 #define PJMEDIA_AUDIO_DEV_HAS_ALSA 1 #include  

    И перестройте (вы можете напрямую перестроить только pjmedia: запустите make в папке pjmedia / build).

    Примечание. Возможно, вы можете отключить pjmedia/build/os-linux.mak сконфигурированный драйвер, отредактировав pjmedia/build/os-linux.mak и установив AC_PJMEDIA_SND на другое значение (например, alsa)