Re: [PATCH] De-Initialize alsa device with _drop instead of _drain

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

 



Hi Dominik,

Thanks for the patch, it is committed on  https://trac.pjsip.org/repos/ticket/2224#ticket.

Best Regards,

Riza

On Thu, Aug 1, 2019 at 2:46 AM <pjsip@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
From: Dominik Schmidt <dominik@xxxxxxxxxx>

This fixes a freezeup when using alsa as default capture device but not
recording anything:

When using the conference bridge to play a wave file while having alsa and
not the null dev as default capture device, but not reading anything from
alsa, the program started to hang after the remote caller disconnected.

This was due to the capture-thread waiting forever on `snd_pcm_drain` and not
returning, and thereby a worker-thread calling alsa_stream_stop waiting forever
on `pj_thread_join(stream->ca_thread);`

This fixes the problem by just ignoring any unhandled pcm frames in the device.
You might want to consider doing the same for the pb_thread.
---
 pjmedia/src/pjmedia-audiodev/alsa_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pjmedia/src/pjmedia-audiodev/alsa_dev.c b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
index 674ff01b..2a99a5f0 100644
--- a/pjmedia/src/pjmedia-audiodev/alsa_dev.c
+++ b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
@@ -604,7 +604,7 @@ static int ca_thread_func (void *arg)

        tstamp.u64 += nframes;
     }
-    snd_pcm_drain (pcm);
+    snd_pcm_drop (pcm);
     TRACE_((THIS_FILE, "ca_thread_func: Stopped"));

     return PJ_SUCCESS;
--
2.22.0


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[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