From 6d85d82c85028b1546b60777004d696f65b88c5f Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 5 Mar 2016 20:09:29 +0900 Subject: [PATCH] audio: mixedPlayerStream.Read now may return 0 byte result --- exp/audio/audio.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exp/audio/audio.go b/exp/audio/audio.go index d974d3af5..4c9ca94e3 100644 --- a/exp/audio/audio.go +++ b/exp/audio/audio.go @@ -43,13 +43,12 @@ func (s *mixedPlayersStream) Read(b []byte) (int, error) { s.context.Lock() defer s.context.Unlock() - l := len(b) / 4 * 4 if len(s.context.players) == 0 { - copy(b, make([]byte, l)) - return l, nil + return 0, nil } closed := []*Player{} - bb := make([]byte, max(1024, l)) + l := len(b) / 4 * 4 + bb := make([]byte, l) ll := l for p := range s.context.players { n, err := p.src.Read(bb)