From e2acd2eafea8bd529226a1db6df2510770237655 Mon Sep 17 00:00:00 2001 From: Lee Howard Date: Tue, 7 Jun 2022 21:04:50 -0700 Subject: [PATCH] I'm not sure why this is necessary, but if we don't sleep/yield for a moment here then we end up with the potential for lost audio data happening. Is it because we're sending audio data to FreeSWITCH faster than it's being sent over the channel. Is it because of audio data in spandsp getting overwritten? Whatever the case, this here seems to do the trick. --- src/mod/applications/mod_spandsp/mod_spandsp_modem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index 96b25d4fea..e9dae7c4d8 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -1279,6 +1279,12 @@ static void *SWITCH_THREAD_FUNC modem_thread(switch_thread_t *thread, void *obj) continue; } + /* I'm not sure why this is necessary, but if we don't sleep/yield for a moment here then we end up with + the potential for lost audio data happening. Is it because we're sending audio data to FreeSWITCH faster + than it's being sent over the channel. Is it because of audio data in spandsp getting overwritten? + Whatever the case, this here seems to do the trick. */ + switch_yield(1000); + do { #ifndef WIN32 r = read(modem->master, buf, 1);