From dcc3fd48b4873c3d616926d781c55cafc1af188e Mon Sep 17 00:00:00 2001 From: Tyler Stiene Date: Thu, 8 Apr 2021 01:14:24 -0400 Subject: [PATCH] correct debug message and add timing --- discord.go | 6 ++++-- mumble.go | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/discord.go b/discord.go index 71aced5..94e5b0f 100644 --- a/discord.go +++ b/discord.go @@ -59,6 +59,7 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, wg *sync.WaitGroup, lastReady := true var readyTimeout *time.Timer + var speakingStart time.Time wg.Add(1) @@ -72,7 +73,8 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, wg *sync.WaitGroup, <-ticker.C if len(pcm) > 1 { if !streaming { - log.Panicln("Debug: Discord start speaking") + log.Println("Debug: Discord start speaking") + speakingStart = time.Now() dd.Bridge.DiscordVoice.Speaking(true) streaming = true } @@ -108,7 +110,7 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, wg *sync.WaitGroup, } else { if streaming { - log.Panicln("Debug: Discord stop speaking") + log.Println("Debug: Discord stop speaking", time.Since(speakingStart).Milliseconds(), "ms") dd.Bridge.DiscordVoice.Speaking(false) streaming = false } diff --git a/mumble.go b/mumble.go index 66a6a4a..1d363d2 100644 --- a/mumble.go +++ b/mumble.go @@ -92,6 +92,10 @@ func (m MumbleDuplex) fromMumbleMixer(ctx context.Context, wg *sync.WaitGroup, t } } + if len(toDiscord) > 20 { + log.Println("Debug: Warning Discord buffer size") + } + if sendAudio { select { case toDiscord <- outBuf: