mirror of https://bitbucket.org/ausocean/av.git
alsa: close pool buffer on stop
This commit is contained in:
parent
54edadbe13
commit
c5c1816607
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue