Rewrite MP4, HLS, MPEG-TS consumers

This commit is contained in:
Alexey Khit
2023-08-20 09:57:46 +03:00
parent f67f6e5b9f
commit 2e4e75e386
17 changed files with 492 additions and 635 deletions

View File

@@ -180,8 +180,7 @@ func handlerWS(tr *ws.Transport, _ *ws.Message) error {
tr.Write(&ws.Message{Type: "mjpeg"})
wr := &writer2{tr: tr} // TODO: fixme
go cons.WriteTo(wr)
go cons.WriteTo(tr.Writer())
tr.OnClose(func() {
stream.RemoveConsumer(cons)
@@ -189,12 +188,3 @@ func handlerWS(tr *ws.Transport, _ *ws.Message) error {
return nil
}
type writer2 struct {
tr *ws.Transport
}
func (w *writer2) Write(p []byte) (n int, err error) {
w.tr.Write(p)
return len(p), nil
}