mirror of https://bitbucket.org/ausocean/av.git
alsa: removed use of pool buffer chunk, Read closes the chunk for us since it's a fully consuming read
This commit is contained in:
parent
fa8fdfdd46
commit
1abca8cd7e
|
@ -414,7 +414,7 @@ func (d *ALSA) input() {
|
||||||
func (d *ALSA) Read(p []byte) (int, error) {
|
func (d *ALSA) Read(p []byte) (int, error) {
|
||||||
// Ready ringbuffer for read.
|
// Ready ringbuffer for read.
|
||||||
d.l.Log(logger.Debug, pkg+"getting next chunk ready")
|
d.l.Log(logger.Debug, pkg+"getting next chunk ready")
|
||||||
chunk, err := d.buf.Next(rbNextTimeout)
|
_, err := d.buf.Next(rbNextTimeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
case nil, io.EOF:
|
case nil, io.EOF:
|
||||||
|
@ -436,16 +436,13 @@ func (d *ALSA) Read(p []byte) (int, error) {
|
||||||
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")
|
||||||
chunk.Close()
|
|
||||||
return 0, nil
|
return 0, nil
|
||||||
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())
|
||||||
chunk.Close()
|
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.l.Log(logger.Debug, fmt.Sprintf("%v read %v bytes", pkg, n))
|
d.l.Log(logger.Debug, fmt.Sprintf("%v read %v bytes", pkg, n))
|
||||||
chunk.Close()
|
|
||||||
return n, nil
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue