mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
audio: mixedPlayerStream.Read now may return 0 byte result
This commit is contained in:
parent
976d61816c
commit
6d85d82c85
@ -43,13 +43,12 @@ func (s *mixedPlayersStream) Read(b []byte) (int, error) {
|
|||||||
s.context.Lock()
|
s.context.Lock()
|
||||||
defer s.context.Unlock()
|
defer s.context.Unlock()
|
||||||
|
|
||||||
l := len(b) / 4 * 4
|
|
||||||
if len(s.context.players) == 0 {
|
if len(s.context.players) == 0 {
|
||||||
copy(b, make([]byte, l))
|
return 0, nil
|
||||||
return l, nil
|
|
||||||
}
|
}
|
||||||
closed := []*Player{}
|
closed := []*Player{}
|
||||||
bb := make([]byte, max(1024, l))
|
l := len(b) / 4 * 4
|
||||||
|
bb := make([]byte, l)
|
||||||
ll := l
|
ll := l
|
||||||
for p := range s.context.players {
|
for p := range s.context.players {
|
||||||
n, err := p.src.Read(bb)
|
n, err := p.src.Read(bb)
|
||||||
|
Loading…
Reference in New Issue
Block a user