mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
audio: mixedPlayingStream returns empty 0s again
This commit is contained in:
parent
d33bb06f1d
commit
8631fbc027
@ -43,11 +43,13 @@ 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 {
|
||||||
return 0, nil
|
ll := min(4096, len(b))
|
||||||
|
copy(b, make([]byte, ll))
|
||||||
|
return ll, nil
|
||||||
}
|
}
|
||||||
closed := []*Player{}
|
closed := []*Player{}
|
||||||
l := len(b) / 4 * 4
|
|
||||||
bb := make([]byte, l)
|
bb := make([]byte, l)
|
||||||
ll := l
|
ll := l
|
||||||
for p := range s.context.players {
|
for p := range s.context.players {
|
||||||
@ -57,9 +59,7 @@ func (s *mixedPlayersStream) Read(b []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
closed = append(closed, p)
|
closed = append(closed, p)
|
||||||
continue
|
} else if err != nil {
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
ll = min(len(p.buf)/4*4, ll)
|
ll = min(len(p.buf)/4*4, ll)
|
||||||
|
Loading…
Reference in New Issue
Block a user