audio/mp3: Bug fix: updating cache in getBytes wrongly

This commit is contained in:
Hajime Hoshi 2017-06-17 01:32:17 +09:00
parent e5fbcd50de
commit bdb87b0257

View File

@ -50,6 +50,7 @@ func Get_Byte() C.unsigned {
for len(readerCache) == 0 && !readerEOF { for len(readerCache) == 0 && !readerEOF {
buf := make([]uint8, 4096) buf := make([]uint8, 4096)
n, err := reader.Read(buf) n, err := reader.Read(buf)
readerCache = append(readerCache, buf[:n]...)
if err != nil { if err != nil {
if err == io.EOF { if err == io.EOF {
readerEOF = true readerEOF = true
@ -57,7 +58,6 @@ func Get_Byte() C.unsigned {
panic(err) panic(err)
} }
} }
readerCache = buf[:n]
} }
if len(readerCache) == 0 { if len(readerCache) == 0 {
return eof return eof