baresip / baresip

Baresip is a modular SIP User-Agent with audio and video support
BSD 3-Clause "New" or "Revised" License
1.72k stars 440 forks source link

Audio loss when audio device hot-plug event occurs on Windows [v2.11.0] #2433

Closed akshata-mistral closed 1 year ago

akshata-mistral commented 1 year ago

I have installed baresip v2.11.0 along with its dependent re and rem packages (both v2.11.0) on my Windows machine. The baresip application was successfully built in Debug mode using the below two commands in a VS Command Prompt:

> cmake .. -DSTATIC=ON -G "NMake Makefiles"
> cmake --build .

During a call (tested with the g711 audio codec), if an audio device is plugged/ unplugged, the audio is lost. On hanging up, the baresip application crashes and the instance needs to be closed.

Note: I tried this same scenario on an Ubuntu machine. The audio was getting re-routed to the newly plugged in audio device.

Steps to reproduce:

  1. Launch the baresip application without connecting any external audio devices.
  2. Make a call using the /dial <IP_ADDR> command.
  3. During the call, plug in a wired earphone device (capable of supporting both record and playback).
  4. The sent audio packets (displayed during the call) becomes zero as shown below: [0:00:47] audio=0/63467 (bit/s)

The details of my ~/.baresip/config file are as follows:

#
# baresip configuration
#

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

# Core
poll_method     select      # poll, select

# SIP
sip_listen      0.0.0.0:5060
#sip_certificate    cert.pem
#sip_cafile     /etc/ssl/certs/ca-certificates.crt
#sip_transports     udp,tcp,tls,ws,wss
#sip_trans_def      udp
#sip_verify_server  yes
sip_tos         160

# Call
call_local_timeout  120
call_max_calls      4
call_hold_other_calls   yes

# Audio
#audio_path     C:/Program Files (x86)/baresip/share/baresip
audio_player        winwave,nil
audio_source        winwave,nil
audio_alert     winwave,nil
#ausrc_srate        48000
#auplay_srate       48000
#ausrc_channels     0
#auplay_channels    0
#audio_txmode       poll        # poll, thread
audio_level     no
ausrc_format        s16     # s16, float, ..
auplay_format       s16     # s16, float, ..
auenc_format        s16     # s16, float, ..
audec_format        s16     # s16, float, ..
audio_buffer        20-160      # ms
audio_buffer_mode   fixed       # fixed, adaptive
audio_silence       -35.0       # in [dB]
audio_telev_pt      101     # payload type for telephone-event

# Video
#video_source       dshow,nil
#video_display      sdl,nil
video_size      640x480
video_bitrate       1000000
video_fps       30.00
video_fullscreen    no
videnc_format       yuv420p

# AVT - Audio/Video Transport
rtp_tos         184
rtp_video_tos       136
#rtp_ports      10000-20000
#rtp_bandwidth      512-1024 # [kbit/s]
jitter_buffer_type  fixed       # off, fixed, adaptive
jitter_buffer_delay 5-10        # frames
rtp_stats       no
#rtp_timeout        60

# Network
#dns_server     1.1.1.1:53
#dns_server     1.0.0.1:53
#dns_fallback       8.8.8.8:53
#dns_getaddrinfo        no
#net_interface      eth0

# Play tones
#file_ausrc     aufile
#file_srate     16000
#file_channels      1

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

#module_path        C:/Program Files (x86)/baresip/lib/baresip/modules

# UI Modules
module          wincons.dll
#module         cons.dll
#module         evdev.dll
#module         httpd.dll

# Audio codec Modules (in order)
#module         opus.dll
#module         amr.dll
#module         g7221.dll
#module         g722.dll
#module         g726.dll
module          g711.dll
#module         l16.dll
#module         mpa.dll
#module         codec2.dll

# Audio filter Modules (in encoding order)
module          auconv.dll
module          auresamp.dll
#module         vumeter.dll
#module         sndfile.dll
#module         plc.dll
#module         webrtc_aec.dll

# Audio driver Modules
module          winwave.dll
#module         jack.dll
#module         portaudio.dll
#module         aubridge.dll
#module         aufile.dll
#module         ausine.dll

# Video codec Modules (in order)
#module         avcodec.dll
#module         vp8.dll
#module         vp9.dll

# Video filter Modules (in encoding order)
#module         selfview.dll
#module         snapshot.dll
#module         swscale.dll
#module         vidinfo.dll
#module         avfilter.dll

# Video source modules
module          dshow.dll
#module         vidbridge.dll

# Video display modules
#module         x11.dll
#module         sdl.dll
#module         fakevideo.dll

# Audio/Video source modules
#module         avformat.dll
#module         gst.dll

# Compatibility modules
#module         ebuacip.dll
module          uuid.dll

# Media NAT modules
module          stun.dll
module          turn.dll
module          ice.dll
#module         natpmp.dll
#module         pcp.dll

# Media encryption modules
#module         srtp.dll
#module         dtls_srtp.dll
#module         gzrtp.dll

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

module_app      account.dll
module_app      contact.dll
module_app      debug_cmd.dll
#module_app     echo.dll
#module_app     gtk.dll
module_app      menu.dll
#module_app     mwi.dll
#module_app     presence.dll
#module_app     serreg.dll
#module_app     syslog.dll
#module_app     mqtt.dll
#module_app     ctrl_tcp.dll
#module_app     ctrl_dbus.dll
#module_app     httpreq.dll
#module_app     multicast.dll
module_app      netroam.dll

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

# DTLS SRTP parameters
#dtls_srtp_use_ec   prime256v1

# UI Modules parameters
cons_listen     0.0.0.0:5555 # cons - Console UI UDP/TCP sockets

http_listen     0.0.0.0:8000 # httpd - HTTP Server

ctrl_tcp_listen     0.0.0.0:4444 # ctrl_tcp - TCP interface JSON

evdev_device        /dev/input/event0

# Opus codec parameters
opus_bitrate        28000 # 6000-510000
#opus_stereo        yes
#opus_sprop_stereo  yes
#opus_cbr       no
#opus_inbandfec     no
#opus_dtx       no
#opus_mirror        no
#opus_complexity    10
#opus_application   audio   # {voip,audio}
#opus_samplerate    48000
#opus_packet_loss   10  # 0-100 percent (expected packet loss)

# Opus Multistream codec parameters
#opus_ms_channels   2   #total channels (2 or 4)
#opus_ms_streams    2   #number of streams
#opus_ms_c_streams  2   #number of coupled streams

vumeter_stderr      yes

#jack_connect_ports yes

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

# ZRTP
#zrtp_hash      no  # Disable SDP zrtp-hash (not recommended)

# Menu
#redial_attempts    0 # Num or <inf>
#redial_delay       5 # Delay in seconds
#ringback_disabled  no
#statmode_default   off
#menu_clean_number  no
#sip_autoanswer_method  rfc5373 # {rfc5373,call-info,alert-info}
#ring_aufile        ring.wav
#callwaiting_aufile callwaiting.wav
#ringback_aufile    ringback.wav
#notfound_aufile    notfound.wav
#busy_aufile        busy.wav
#error_aufile       error.wav
#sip_autoanswer_aufile  autoanswer.wav

# GTK
#gtk_clean_number   no

# avcodec
#avcodec_h264enc    libx264
#avcodec_h264dec    h264
#avcodec_h265enc    libx265
#avcodec_h265dec    hevc
#avcodec_hwaccel    nvenc
#avcodec_profile_level_id 42002a
#avcodec_keyint     10

# ctrl_dbus
#ctrl_dbus_use  system      # system, session

# mqtt
#mqtt_broker_host   sollentuna.example.com
#mqtt_broker_port   1883
#mqtt_broker_cafile /path/to/broker-ca.crt  # set this to enforce TLS
#mqtt_broker_clientid   baresip01   # has to be unique
#mqtt_broker_user   user
#mqtt_broker_password   pass
#mqtt_basetopic     baresip/01

# sndfile
#snd_path       /tmp

# EBU ACIP
#ebuacip_jb_type    fixed   # auto,fixed

# HTTP request module
#httpreq_ca     trusted1.pem
#httpreq_ca     trusted2.pem
#httpreq_dns        1.1.1.1
#httpreq_dns        8.8.8.8
#httpreq_hostname   myserver
#httpreq_cert       cert.pem
#httpreq_key        key.pem

# multicast receivers (in priority order)- port number must be even
#multicast_call_prio    0
#multicast_ttl  1
#multicast_jbuf_type    fixed       # off, fixed, adaptive
#multicast_jbuf_delay   5-10        # frames
#multicast_listener 224.0.2.21:50000
#multicast_listener 224.0.2.21:50002

# avformat
#avformat_hwaccel   nvenc
#avformat_inputformat   mjpeg
#avformat_decoder   mjpeg
#avformat_pass_through  yes
#avformat_rtsp_transport    udp

# ice
#ice_policy     all # all, relay (candidates)

There are no error logs during the loss of audio nor when the application crashes. I'm attaching a screenshot of the application after hanging up a call.

baresip
alfredh commented 1 year ago

Can you please provide the backtrace for the crash ? (in text format pls, not as a picture).

akshata-mistral commented 1 year ago

According to re\src\btrace , Windows does not support the Backtrace API.

@file btrace.c Backtrace API (Linux/Unix only)

How can we proceed further?

alfredh commented 1 year ago

perhaps you can use Visual Studio or some other Windows debugger ?

akshata-mistral commented 1 year ago

Hi Alfred

I re-produced the above mentioned scenario in debugger mode on Visual Studio. I have attached the details of the call stack below for your reference.

On further analysis using Step-Into, I noticed that when we hang up the call, the crash occurs in the file winwave/src.c, in its function ausrc_destructor at the line waveInStop(st->wavein).

Here are the logs of the Call Stack:

baresip.exe!ausrc_destructor(void * arg) Line 39
    at baresip_master\baresip\modules\winwave\src.c(39)
baresip.exe!mem_deref(void * data) Line 379
    at baresip_master\re\src\mem\mem.c(379)
baresip.exe!stop_tx(autx * tx, audio * a) Line 270
    at baresip_master\baresip\src\audio.c(270)
baresip.exe!audio_stop(audio * a) Line 1715
    at baresip_master\baresip\src\audio.c(1715)
baresip.exe!call_stream_stop(call * call) Line 231
    at baresip_master\baresip\src\call.c(231)
baresip.exe!call_hangup(call * call, unsigned short scode, const char * reason) Line 1240
    at baresip_master\baresip\src\call.c(1240)
baresip.exe!ua_hangup(ua * ua, call * call, unsigned short scode, const char * reason) Line 1355
    at baresip_master\baresip\src\ua.c(1355)
baresip.exe!cmd_hangup(re_printf * pf, void * arg) Line 787
    at baresip_master\baresip\modules\menu\static_menu.c(787)
baresip.exe!cmd_process(commands * commands, cmd_ctx * * ctxp, char key, re_printf * pf, void * data) Line 566
    at baresip_master\baresip\src\cmd.c(566)
baresip.exe!ui_input_key(ui_sub * uis, char key, re_printf * pf) Line 67
    at baresip_master\baresip\src\ui.c(67)
baresip.exe!report_key(ui_st * ui, char key) Line 68
    at baresip_master\baresip\modules\wincons\wincons.c(68)
baresip.exe!mqueue_handler(int id, void * data, void * arg) Line 132
    at baresip\modules\wincons\wincons.c(132)
baresip.exe!event_handler(int flags, void * arg) Line 87
    at baresip_master\re\src\mqueue\mqueue.c(87)
baresip.exe!fd_poll(re * re) Line 925
    at baresip_master\re\src\main\main.c(925)
baresip.exe!re_main(void(*)(int) signalh) Line 1100
    at baresip_master\re\src\main\main.c(1100)
baresip.exe!main(int argc, char * * argv) Line 323
    at baresip_master\baresip\src\main.c(323)
[External Code]

Any idea what could be causing this issue?

Thanks

alfredh commented 1 year ago

please take a look at this function:

static void CALLBACK waveInCallback(HWAVEOUT hwo,
                    UINT uMsg,
                    DWORD_PTR dwInstance,
                    DWORD_PTR dwParam1,
                    DWORD_PTR dwParam2)
{
    struct ausrc_st *st = (struct ausrc_st *)dwInstance;
    WAVEHDR *wh = (WAVEHDR *)dwParam1;
    struct auframe af;

    (void)hwo;
    (void)dwParam2;

    if (!st->rh)
        return;

    switch (uMsg) {

    case WIM_CLOSE:
        st->rdy = false;
        break;

    case WIM_OPEN:
        st->rdy = true;
        break;

    case WIM_DATA:
        if (st->inuse < (READ_BUFFERS-1))
            add_wave_in(st);

        auframe_init(&af, st->prm.fmt, (void *)wh->lpData,
                 wh->dwBytesRecorded / st->sampsz, st->prm.srate,
                 st->prm.ch);
        af.timestamp = tmr_jiffies_usec();

        st->rh(&af, st->arg);

        waveInUnprepareHeader(st->wavein, wh, sizeof(*wh));
        st->inuse--;
        break;

    default:
        break;
    }
}

Can you add some debug printf here, and see if something happens when you unplug the audio device ?

akshata-mistral commented 1 year ago

I added some debug prints inside the src.c's callback function as follows:

switch (uMsg) {

    case WIM_CLOSE:
        debug("\nInside WIM_CLOSE\n");
        st->rdy = false;
        break;

    case WIM_OPEN:
        debug("\nInside WIM_OPEN\n");
        st->rdy = true;
        break;

    case WIM_DATA:
        debug("\nInside WIM_DATA: st->inuse < (READ_BUFFERS-1) = %d\n", st->inuse < (READ_BUFFERS - 1));
        if (st->inuse < (READ_BUFFERS-1))
            add_wave_in(st);

        auframe_init(&af, st->prm.fmt, (void *)wh->lpData,
                 wh->dwBytesRecorded / st->sampsz, st->prm.srate,
                 st->prm.ch);
        af.timestamp = tmr_jiffies_usec();

        st->rh(&af, st->arg);

        waveInUnprepareHeader(st->wavein, wh, sizeof(*wh));
        st->inuse--;
        break;

    default:
        debug("\nuMsg: %d\n", uMsg);
        break;
    }

I have provided a summary of the logs from the baresip application below.

a. During a call, a headset is plugged in.

/dial 192.168.13.154
alice@office: selected for request
call uri: 192.168.13.154
call: alloc with params laddr=192.168.13.139, af=AF_INET, use_rtp=1
call: use_video=0
call: connecting to 'sip:192.168.13.154'..
call id: 8b7dee770434df7c
call: SIP Progress: 180 Ringing (/)
play: C:/baresip_master/baresip/out/install/x64-Debug/share/baresip/ringback.wav: No such file or directory [2]
call: got SDP answer (321 bytes)
alice@office: Call answered: sip:192.168.13.154
call: update media
stream: update 'audio'
stream: receive: setting SSRC: ee872fdd
stream: audio: starting RTCP with remote 192.168.13.154:27331
audio: update
audio: Set audio decoder: PCMU 8000Hz 1ch
audio: start
audio: create auplay buffer [20 - 160 ms] [320 - 2560 bytes]
audio: player started with sample format S16LE
audio: Set audio encoder: PCMU 8000Hz 1ch
audio: start

Inside WIM_OPEN
audio: source started with sample format S16LE
audio tx pipeline:     winwave ---> aubuf ---> auconv ---> auresamp ---> PCMU
audio rx pipeline:     winwave <--- aubuf <--- auconv <--- auresamp <--- PCMU
call: stream start (active=1)
audio: start
stream: audio: enable RTP from remote
alice@office: Call established: sip:192.168.13.154
stream: incoming rtp for 'audio' established, receiving from 192.168.13.154:27330

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 0
auresamp: resample encoder 8000/1 --> 8000/1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 0

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
auresamp: resample decoder 8000/1 --> 8000/1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
[0:00:01] audio=0/0 (bit/s)
Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
[0:00:01] audio
.
.
.

[0:00:03] audio=0/0 (bit/s)
Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
[0:00:14] audio=0/63851 (bit/s)

The audio is working as expected before the headset is plugged in.

The Inside WIM_DATA: prints that we see is from BEFORE the headset was connected. Once the headset is connected, there are no more prints from the callback function and the audio is lost.

b. During the call, a headset is unplugged.

/dial 192.168.13.154
alice@office: selected for request
call uri: 192.168.13.154
call: alloc with params laddr=192.168.13.139, af=AF_INET, use_rtp=1
call: use_video=0
call: connecting to 'sip:192.168.13.154'..
call id: 66c80e7296b23468
call: SIP Progress: 180 Ringing (/)
play: C:/baresip_master/baresip/out/install/x64-Debug/share/baresip/ringback.wav: No such file or directory [2]
call: got SDP answer (321 bytes)
alice@office: Call answered: sip:192.168.13.154
call: update media
stream: update 'audio'
stream: receive: setting SSRC: dd378e0b
stream: audio: starting RTCP with remote 192.168.13.154:21625
audio: update
audio: Set audio decoder: PCMU 8000Hz 1ch
audio: start
audio: create auplay buffer [20 - 160 ms] [320 - 2560 bytes]
audio: player started with sample format S16LE
audio: Set audio encoder: PCMU 8000Hz 1ch
audio: start

Inside WIM_OPEN
audio: source started with sample format S16LE
audio tx pipeline:     winwave ---> aubuf ---> auconv ---> auresamp ---> PCMU
audio rx pipeline:     winwave <--- aubuf <--- auconv <--- auresamp <--- PCMU
call: stream start (active=1)
audio: start
stream: audio: enable RTP from remote
alice@office: Call established: sip:192.168.13.154
stream: incoming rtp for 'audio' established, receiving from 192.168.13.154:21624

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 0
auresamp: resample encoder 8000/1 --> 8000/1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 0

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
auresamp: resample decoder 8000/1 --> 8000/1
[0:00:00] audio=0/0 (bit/s)
Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
.
.
.

[0:00:02] audio=0/0 (bit/s)
Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1

Inside WIM_DATA: st->inuse < (READ_BUFFERS-1) = 1
[0:00:14] audio=0/10276 (bit/s)

In this case, the audio is working as expected before the headset is unplugged.

The Inside WIM_DATA: prints that we see, is from BEFORE the headset was disconnected. Once it is disconnected, there are no prints from the callback function.

In both the scenarios, I don't see any logs from the callback function once a connection/ disconnection event occurs.

alfredh commented 1 year ago

Many thanks for the debug info!

It looks like the audio driver goes into a strange state when your audio device is unplugged. perhaps there is a windows API for audio device notification plug/unplug that we could use ?

In the destructor before calling the function that is crashing, could you please add printf of the handle/pointer ? is there a way to check if a handle is valid ?

You can also try the portaudio module and see if that works any better

akshata-mistral commented 1 year ago

Hi Alfred

Thanks so much for the portaudio suggestion. I was able to integrate the portaudio module to the baresip application. This seems to be a possible alternative and looks like it is not crashing when a plug/ unplug event occurs.

I just have one doubt regarding the inclusion of the portaudio module as part of the .baresip\config file. I didn't find any documentation of the expected parameters to be fed along with portaudio. Could you provide the syntax to use portaudio as the audio_player and audio_source for the application?

At the moment, I'm providing the device id as shown below:

audio_player        portaudio,"2"
audio_source        portaudio,nil
audio_alert         portaudio,"2"

For the audio_source, the nil value gives the desired result. But for the audio_player and the audio_alert, nil doesn't give any sound (although the baresip application shows that audio packets are being received). When I provide the device index value (here: 2), audio output is heard.

I have added a snippet of my .baresip\config file below wherein I have replaced the values for the audio_player, audio_source and audio_alert with the portaudio audio driver for your reference.

# Audio
audio_path      ../share
#audio_player       winwave,nil
#audio_source       winwave,nil
#audio_alert        winwave,nil

audio_player        portaudio,"2"
audio_source        portaudio,nil
audio_alert         portaudio,"2"

#ausrc_srate        48000
#auplay_srate       48000
#ausrc_channels     0
#auplay_channels    0
#audio_txmode       poll        # poll, thread
audio_level     no
ausrc_format        s16     # s16, float, ..
auplay_format       s16     # s16, float, ..
auenc_format        s16     # s16, float, ..
audec_format        s16     # s16, float, ..
audio_buffer        20-160      # ms
audio_buffer_mode   fixed       # fixed, adaptive
audio_silence       -35.0       # in [dB]
audio_telev_pt      101     # payload type for telephone-event

.
.

#module         winwave.dll
#module         jack.dll
module          portaudio.dll

I have added the logs of the list of devices along with their device indices which I got from the portaudio\portaudio.c 's pa_init() function.

static int pa_init(void)
{
        .
        .
        const PaDeviceInfo *devinfo = Pa_GetDeviceInfo(i);
    struct mediadev *dev;

    info("portaudio: device %d: %s\n", i, devinfo->name);
        .
        .
}
portaudio: device 0: Microsoft Sound Mapper - Input
portaudio: device 1: Microphone Array (Realtek(R) Au
portaudio: device 2: Microsoft Sound Mapper - Output
portaudio: device 3: Speakers (Realtek(R) Audio)
portaudio: device 4: Speakers (Realtek(R) Audio)
portaudio: device 5: Microphone Array (Realtek(R) Audio)
portaudio: device 6: Stereo Mix (Realtek HD Audio Stereo input)
portaudio: device 7: Microphone Array 1 (Realtek HD Audio Mic input with SST)
portaudio: device 8: Microphone Array 2 (Realtek HD Audio Mic input with SST)
portaudio: device 9: Microphone Array 3 (Realtek HD Audio Mic input with SST)
portaudio: device 10: Speakers 1 (Realtek HD Audio output with SST)
portaudio: device 11: Speakers 2 (Realtek HD Audio output with SST)
portaudio: device 12: PC Speaker (Realtek HD Audio output with SST)
portaudio: device 13: FrontMic (Realtek HD Audio Front Mic input)
portaudio: device 14: Headphones 1 (Realtek HD Audio 2nd output with SST)
portaudio: device 15: Headphones 2 (Realtek HD Audio 2nd output with SST)
portaudio: device 16: PC Speaker (Realtek HD Audio 2nd output with SST)
portaudio: device 17: Headset (@System32\drivers\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0
;(Galaxy Buds2 (A5EA)))
portaudio: device 18: Headset (@System32\drivers\bthhfenum.sys,#2;%1 Hands-Free AG Audio%0
;(Galaxy Buds2 (A5EA)))
portaudio: device 19: Headphones ()
tomek-o commented 1 year ago

It looks like the audio driver goes into a strange state when your audio device is unplugged.

I think it would be identical to https://github.com/baresip/baresip/issues/148 and it is rather "hang" than "crash". Probably for this particular audio device plugging external microphone disables the other one(s) currently in use.

akshata-mistral commented 1 year ago

Thanks for the suggestion @tomek-o!

I referred to njeisecke/baresip's git repo under the tag: patched_v2.11.0 where he has made the necessary changes to the winwave module [play.c and src.c files].

The audio hanging issue during a plug/ unplug event is resolved!