HLS client: flush buffers after every write

This commit is contained in:
aler9 2021-04-24 17:07:13 +02:00
parent 9350019262
commit ec3e9230ed
1 changed files with 14 additions and 1 deletions

View File

@ -110,7 +110,20 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
res := <-cres
if res != nil {
io.Copy(w, res)
buf := make([]byte, 4096)
for {
n, err := res.Read(buf)
if err != nil {
return
}
_, err = w.Write(buf[:n])
if err != nil {
return
}
w.(http.Flusher).Flush()
}
}
}