Browse Source

feat: add WebSocketFlv support

pull/6/head
halwu(吴浩麟) 9 years ago
parent
commit
829653ab82
  1. 7
      protocol/rtmp/stream.go
  2. 13
      protocol/websocketflv/server.go

7
protocol/rtmp/stream.go

@ -137,13 +137,6 @@ func (s *Stream) AddWriter(w av.WriteCloser) { @@ -137,13 +137,6 @@ func (s *Stream) AddWriter(w av.WriteCloser) {
}
func (s *Stream) TransStart() {
// debug mode don't use it
// defer func() {
// if r := recover(); r != nil {
// log.Println("rtmp TransStart panic: ", r)
// }
// }()
s.isStart = true
var p av.Packet
for {

13
protocol/websocketflv/server.go

@ -8,7 +8,6 @@ import ( @@ -8,7 +8,6 @@ import (
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/protocol/httpflv"
"github.com/gorilla/websocket"
"io"
)
type Server struct {
@ -68,17 +67,7 @@ func (server *Server) handleConn(w http.ResponseWriter, r *http.Request) { @@ -68,17 +67,7 @@ func (server *Server) handleConn(w http.ResponseWriter, r *http.Request) {
return
}
flvWriter := httpflv.NewFLVWriter(paths[0], paths[1], url, &Writer{writer })
flvWriter := httpflv.NewFLVWriter(paths[0], paths[1], url, writer)
server.handler.HandleWriter(flvWriter)
flvWriter.Wait()
}
type Writer struct {
writer io.WriteCloser
}
func (writer *Writer) Write(p []byte) (n int, err error) {
n, err = writer.writer.Write(p)
writer.writer.Close()
return
}

Loading…
Cancel
Save