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) {
|
||||
// Ready ringbuffer for read.
|
||||
d.l.Log(logger.Debug, pkg+"getting next chunk ready")
|
||||
chunk, err := d.buf.Next(rbNextTimeout)
|
||||
_, err := d.buf.Next(rbNextTimeout)
|
||||
if err != nil {
|
||||
switch err {
|
||||
case nil, io.EOF:
|
||||
|
@ -436,16 +436,13 @@ func (d *ALSA) Read(p []byte) (int, error) {
|
|||
switch err {
|
||||
case nil, io.EOF:
|
||||
d.l.Log(logger.Debug, pkg+"EOF")
|
||||
chunk.Close()
|
||||
return 0, nil
|
||||
default:
|
||||
d.l.Log(logger.Error, pkg+"unexpected error from Read", "error", err.Error())
|
||||
chunk.Close()
|
||||
return 0, nil
|
||||
}
|
||||
}
|
||||
d.l.Log(logger.Debug, fmt.Sprintf("%v read %v bytes", pkg, n))
|
||||
chunk.Close()
|
||||
return n, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue