Browse Source

HLS client: flush buffers after every write

pull/372/head
aler9 5 years ago
parent
commit
ec3e9230ed
  1. 15
      internal/serverhls/server.go

15
internal/serverhls/server.go

@ -110,7 +110,20 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -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()
}
}
}

Loading…
Cancel
Save