From c5c181660771a33dddda17663dadf9b952973e4e Mon Sep 17 00:00:00 2001 From: Trek H Date: Mon, 14 Feb 2022 14:44:35 +1030 Subject: [PATCH] alsa: close pool buffer on stop --- device/alsa/alsa.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/device/alsa/alsa.go b/device/alsa/alsa.go index 73a56a83..ededc6c1 100644 --- a/device/alsa/alsa.go +++ b/device/alsa/alsa.go @@ -377,6 +377,7 @@ func (d *ALSA) input() { d.dev.Close() d.dev = nil } + d.buf.Close() return } @@ -418,8 +419,8 @@ func (d *ALSA) Read(p []byte) (int, error) { if err != nil { switch err { case nil, io.EOF: - d.l.Log(logger.Debug, pkg+"EOF") - return 0, nil + d.l.Log(logger.Debug, pkg+"EOF from Next") + return 0, err case pool.ErrTimeout: d.l.Log(logger.Debug, pkg+"pool buffer timeout") return 0, nil @@ -435,7 +436,7 @@ func (d *ALSA) Read(p []byte) (int, error) { if err != nil { switch err { case nil, io.EOF: - d.l.Log(logger.Debug, pkg+"EOF from Read, stopping") + d.l.Log(logger.Debug, pkg+"EOF from Read") return n, err default: d.l.Log(logger.Error, pkg+"unexpected error from Read", "error", err.Error())