mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
server: support reading with VLC and multicast
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -377,8 +378,20 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) {
|
||||
res.Header["Content-Base"] = base.HeaderValue{req.URL.String() + "/"}
|
||||
res.Header["Content-Type"] = base.HeaderValue{"application/sdp"}
|
||||
|
||||
// VLC uses multicast if the SDP contains a multicast address.
|
||||
// therefore, we introduce a special query (vlcmulticast) that allows
|
||||
// to return a SDP that contains a multicast address.
|
||||
multicast := false
|
||||
if sc.s.MulticastIPRange != "" {
|
||||
if q, err := url.ParseQuery(query); err == nil {
|
||||
if _, ok := q["vlcmulticast"]; ok {
|
||||
multicast = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if stream != nil {
|
||||
res.Body = stream.Tracks().Write()
|
||||
res.Body = stream.Tracks().Write(multicast)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user