Giter VIP home page Giter VIP logo

Comments (9)

sreimers avatar sreimers commented on May 18, 2024

Hello,
can you tell us your baresip version and paste your ~/.baresip/config please.

Thank you!

from baresip.

piwinux avatar piwinux commented on May 18, 2024

I have this problem with version 0.4.14 and with the GitHub version. For both builds I use re-0.4.13 and rem-0.4.6.

Here is my ~/.baresip/config:

#
# baresip configuration
#

#------------------------------------------------------------------------------

# Core
poll_method     epoll       # poll, select, epoll ..

# SIP
sip_trans_bsize     128
#sip_listen     0.0.0.0:5060
#sip_certificate    cert.pem

# Audio
audio_player        alsa,default
audio_source        alsa,default
audio_alert     alsa,default
audio_srate     8000-48000
audio_channels      1-2
#ausrc_srate        48000
#auplay_srate       48000
#ausrc_channels     0
#auplay_channels        0

# Video
#video_source       v4l2,/dev/video0
#video_display      x11,nil
video_size      352x288
video_bitrate       500000
video_fps       25

# AVT - Audio/Video Transport
rtp_tos         184
#rtp_ports      10000-20000
#rtp_bandwidth      512-1024 # [kbit/s]
rtcp_enable     no
rtcp_mux        no
jitter_buffer_delay 5-10        # frames
rtp_stats       no

# Network
#dns_server     10.0.0.1:53
#net_interface      wlan0

# BFCP
#bfcp_proto     udp

#------------------------------------------------------------------------------
# Modules

#module_path        /usr/local/lib/baresip/modules

# UI Modules
module          stdio.so
#module         cons.so
#module         evdev.so
#module         httpd.so

# Audio codec Modules (in order)
#module         opus.so
#module         silk.so
#module         amr.so
#module         g7221.so
#module         g722.so
#module         g726.so
module          g711.so
#module         gsm.so
#module         l16.so
#module         speex.so
#module         bv32.so

# Audio filter Modules (in encoding order)
module          vumeter.so
#module         sndfile.so
#module         speex_aec.so
#module         speex_pp.so
#module         plc.so

# Audio driver Modules
module          alsa.so
#module         portaudio.so

# Video codec Modules (in order)
#module         avcodec.so
#module         vpx.so

# Video filter Modules (in encoding order)
#module         selfview.so

# Video source modules
#module         v4l.so
#module         v4l2.so
#module         x11grab.so
#module         cairo.so

# Video display modules
#module         x11.so
#module         sdl2.so

# Audio/Video source modules
#module         rst.so
#module         gst.so

# Media NAT modules
module          stun.so
module          turn.so
module          ice.so
module          natpmp.so

# Media encryption modules
#module         srtp.so
#module         dtls_srtp.so


#------------------------------------------------------------------------------
# Temporary Modules (loaded then unloaded)

module_tmp      uuid.so
module_tmp      account.so


#------------------------------------------------------------------------------
# Application Modules

module_app      auloop.so
module_app      contact.so
module_app      menu.so
#module_app     mwi.so
#module_app     natbd.so
#module_app     presence.so
#module_app     syslog.so
module_app      vidloop.so


#------------------------------------------------------------------------------
# Module parameters


cons_listen     0.0.0.0:5555

http_listen     0.0.0.0:8000

evdev_device        /dev/input/event0

# Speex codec parameters
speex_quality       7 # 0-10
speex_complexity    7 # 0-10
speex_enhancement   0 # 0-1
speex_mode_nb       3 # 1-6
speex_mode_wb       6 # 1-6
speex_vbr       0 # Variable Bit Rate 0-1
speex_vad       0 # Voice Activity Detection 0-1
speex_agc_level     8000

# Opus codec parameters
opus_bitrate        28000 # 6000-510000

# NAT Behavior Discovery
natbd_server        creytiv.com
natbd_interval      600     # in seconds

# Selfview
video_selfview      window # {window,pip}
#selfview_size      64x64

# ICE
ice_turn        no
ice_debug       no
ice_nomination      regular # {regular,aggressive}
ice_mode        full    # {full,lite}

from baresip.

sreimers avatar sreimers commented on May 18, 2024

You can also test with audio-loop (command "a"). Do you use a clean alsa or with pulseaudio?

from baresip.

piwinux avatar piwinux commented on May 18, 2024

I tried the audio-loop command as you suggested, but I have no sound. It seems that pulseaudio is used when I use baresip; I don't know much regarding audio configuration, but based on this answer on Ask Ubuntu, I did grep the ouput of pactl list:

$ pactl list | grep baresip
                application.name = "ALSA plug-in [baresip]"
                application.process.binary = "baresip"
                module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [baresip]"
                application.name = "ALSA plug-in [baresip]"
                application.process.binary = "baresip"
                module-stream-restore.id = "source-output-by-application-name:ALSA plug-in [baresip]"
                application.name = "ALSA plug-in [baresip]"
                application.process.binary = "baresip"
                application.name = "ALSA plug-in [baresip]"
                application.process.binary = "baresip"

I can try without PulseAudio but I have to find out how to disable it for Baresip first... The output of baresip when invoking audio-loop gives:

Audio-loop: 8000Hz, 1ch
8000Hz 1ch  n_read=238 n_write=244 rw_ratio=0.97audio-loop stopped

However, joining the thread does not block when quitting the application!

from baresip.

piwinux avatar piwinux commented on May 18, 2024

I just tried audio-loop when running baresip without pulseaudio (using pasuspender as mentioned here). I have no sound, and the application hangs when exiting; the backtrace is slightly different but leads to the same code:

(gdb) bt
#0  0x00007ffff6e664db in pthread_join (threadid=140737122633472, thread_return=0x0) at pthread_join.c:92
#1  0x00007ffff53504b6 in ausrc_destructor (arg=0x671790) at modules/alsa/alsa_src.c:40
#2  0x00007ffff7bbd584 in mem_deref (data=0x671790) at src/mem/mem.c:318
#3  0x00007ffff4441e21 in auloop_destructor (arg=0x660430) at modules/auloop/auloop.c:75
#4  0x00007ffff7bbd584 in mem_deref (data=0x660430) at src/mem/mem.c:318
#5  0x00007ffff4442851 in auloop_stop (pf=0x7ffff5b57550 <pf_stderr>, arg=0x7fffffffdd90) at modules/auloop/auloop.c:349
#6  0x00000000004113c2 in cmd_process (ctxp=0x6299f0 <uictx>, key=65 'A', pf=0x7ffff5b57550 <pf_stderr>) at src/cmd.c:302
#7  0x000000000041bd43 in ui_handler (key=65 'A', pf=0x7ffff5b57550 <pf_stderr>) at src/ui.c:17
#8  0x000000000041be40 in ui_input_key (key=65 'A', pf=0x7ffff5b57550 <pf_stderr>) at src/ui.c:83
#9  0x00007ffff5956d0f in report_key (ui=0x655ae0, key=65 'A') at modules/stdio/stdio.c:66
#10 0x00007ffff5956d9f in ui_fd_handler (flags=1, arg=0x655ae0) at modules/stdio/stdio.c:90
#11 0x00007ffff7bbb53f in fd_handler (re=0x7ffff7ddbcc0 <global_re>, fd=0, flags=1) at src/main/main.c:246
#12 0x00007ffff7bbc4f1 in fd_poll (re=0x7ffff7ddbcc0 <global_re>) at src/main/main.c:849
#13 0x00007ffff7bbc7ee in re_main (signalh=0x41f29b <signal_handler>) at src/main/main.c:992
#14 0x000000000041f54b in main (argc=1, argv=0x7fffffffe1b8) at src/main.c:169

from baresip.

sreimers avatar sreimers commented on May 18, 2024

With pulseaudio 6.0 on archlinux there is no such problem. You can check with "pavucontrol" which audio interface is mapped to baresip. Maybe I can check this with debian jessie and pulseaudio next week too.

from baresip.

alfredh avatar alfredh commented on May 18, 2024

most likely the read thread is hanging here:

    while (st->run) {
        err = snd_pcm_readi(st->read, st->sampv, num_frames);

in blocking mode this function call will not return until there are samples in the buffer.
so it you have problems with your Audio device then we might have to wait forever :)

could you try a couple of things:

  1. use NONBLOCK mode

in alsa_src.c:

-       err = snd_pcm_open(&st->read, st->device, SND_PCM_STREAM_CAPTURE, 0);
+       err = snd_pcm_open(&st->read, st->device, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK);
  1. close the audio-device BEFORE calling pthread_join, in destructor:
static void ausrc_destructor(void *arg)
{
    struct ausrc_st *st = arg;

    if (st->read)
        snd_pcm_close(st->read);

    /* Wait for termination of other thread */
    if (st->run) {
        st->run = false;
        (void)pthread_join(st->thread, NULL);
    }

    mem_deref(st->sampv);
    mem_deref(st->device);
}

I have seen similar bugs before, so most likely it is a ALSA API-usage error (i.e. baresip).

NOTE: using non-blocking mode is not really an option as it consumes 100% cpu

from baresip.

alfredh avatar alfredh commented on May 18, 2024

http://alsa-devel.alsa-project.narkive.com/c9WPMEnf/should-snd-pcm-drop-interrupt-snd-pcm-writei-call

from baresip.

alfredh avatar alfredh commented on May 18, 2024

is there any more updates on this one?

if not feel free to close the Issue.

from baresip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.