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.Close()
|
||||||
d.dev = nil
|
d.dev = nil
|
||||||
}
|
}
|
||||||
|
d.buf.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,8 +419,8 @@ func (d *ALSA) Read(p []byte) (int, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
case nil, io.EOF:
|
case nil, io.EOF:
|
||||||
d.l.Log(logger.Debug, pkg+"EOF")
|
d.l.Log(logger.Debug, pkg+"EOF from Next")
|
||||||
return 0, nil
|
return 0, err
|
||||||
case pool.ErrTimeout:
|
case pool.ErrTimeout:
|
||||||
d.l.Log(logger.Debug, pkg+"pool buffer timeout")
|
d.l.Log(logger.Debug, pkg+"pool buffer timeout")
|
||||||
return 0, nil
|
return 0, nil
|
||||||
|
@ -435,7 +436,7 @@ func (d *ALSA) Read(p []byte) (int, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
case nil, io.EOF:
|
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
|
return n, err
|
||||||
default:
|
default:
|
||||||
d.l.Log(logger.Error, pkg+"unexpected error from Read", "error", err.Error())
|
d.l.Log(logger.Error, pkg+"unexpected error from Read", "error", err.Error())
|
||||||
|
|
Loading…
Reference in New Issue