From 017d8b2ce4825bc365ffb3f8c6db3e5a10a9213a Mon Sep 17 00:00:00 2001 From: Yoshida Hiroshi Date: Wed, 31 Jan 2024 12:00:20 +0900 Subject: [PATCH] =?UTF-8?q?EOF=20=E6=99=82=E3=81=AF=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=82=92=E5=87=BA=E3=81=95=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- amazon_transcribe_handler.go | 13 ++++++++----- speech_to_text_handler.go | 12 +++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/amazon_transcribe_handler.go b/amazon_transcribe_handler.go index 5cff578..4527a2e 100644 --- a/amazon_transcribe_handler.go +++ b/amazon_transcribe_handler.go @@ -73,11 +73,14 @@ func (h *AmazonTranscribeHandler) Handle(ctx context.Context, reader io.Reader) go func() { defer oggWriter.Close() if err := opus2ogg(ctx, reader, oggWriter, h.SampleRate, h.ChannelCount, h.Config); err != nil { - zlog.Error(). - Err(err). - Str("channel_id", h.ChannelID). - Str("connection_id", h.ConnectionID). - Send() + if err != io.EOF { + zlog.Error(). + Err(err). + Str("channel_id", h.ChannelID). + Str("connection_id", h.ConnectionID). + Send() + } + oggWriter.CloseWithError(err) return } diff --git a/speech_to_text_handler.go b/speech_to_text_handler.go index 4441b30..705ab79 100644 --- a/speech_to_text_handler.go +++ b/speech_to_text_handler.go @@ -75,11 +75,13 @@ func (h *SpeechToTextHandler) Handle(ctx context.Context, reader io.Reader) (*io go func() { defer oggWriter.Close() if err := opus2ogg(ctx, reader, oggWriter, h.SampleRate, h.ChannelCount, h.Config); err != nil { - zlog.Error(). - Err(err). - Str("channel_id", h.ChannelID). - Str("connection_id", h.ConnectionID). - Send() + if err != io.EOF { + zlog.Error(). + Err(err). + Str("channel_id", h.ChannelID). + Str("connection_id", h.ConnectionID). + Send() + } oggWriter.CloseWithError(err) return }