支持国标级联

This commit is contained in:
yangjiechina
2024-10-22 11:23:43 +08:00
parent e19a8708bd
commit 9090e28077
49 changed files with 1437 additions and 805 deletions

View File

@@ -124,7 +124,7 @@ func (h handler) OnDescribe(request Request) (*http.Response, []byte, error) {
}
}
sinkId := stream.GenerateSinkId(request.session.conn.RemoteAddr())
sinkId := stream.NetAddr2SinkId(request.session.conn.RemoteAddr())
sink_ := NewSink(sinkId, request.sourceId, request.session.conn, func(sdp string) {
response = NewOKResponse(request.headers.Get("Cseq"))
response.Header.Set("Content-Type", "application/sdp")

View File

@@ -28,9 +28,9 @@ type sink struct {
playing bool //是否已经收到play请求
}
func NewSink(id stream.SinkId, sourceId string, conn net.Conn, cb func(sdp string)) stream.Sink {
func NewSink(id stream.SinkID, sourceId string, conn net.Conn, cb func(sdp string)) stream.Sink {
return &sink{
stream.BaseSink{Id_: id, SourceId_: sourceId, Protocol_: stream.ProtocolRtsp, Conn: conn},
stream.BaseSink{ID: id, SourceID: sourceId, Protocol: stream.TransStreamRtsp, Conn: conn},
nil,
cb,
false,

View File

@@ -275,7 +275,7 @@ func NewTransStream(addr net.IPAddr, urlFormat string) stream.TransStream {
return t
}
func TransStreamFactory(source stream.Source, protocol stream.Protocol, streams []utils.AVStream) (stream.TransStream, error) {
func TransStreamFactory(source stream.Source, protocol stream.TransStreamProtocol, streams []utils.AVStream) (stream.TransStream, error) {
trackFormat := "?track=%d"
return NewTransStream(net.IPAddr{
IP: net.ParseIP(stream.AppConfig.PublicIP),