mirror of
https://github.com/aler9/gortsplib
synced 2025-10-21 14:19:36 +08:00
fix parsing and generation of control attributes that contain RTSPS URLs (#216)
This commit is contained in:
@@ -167,7 +167,8 @@ func (m Media) URL(contentBase *url.URL) (*url.URL, error) {
|
||||
}
|
||||
|
||||
// control attribute contains an absolute path
|
||||
if strings.HasPrefix(m.Control, "rtsp://") {
|
||||
if strings.HasPrefix(m.Control, "rtsp://") ||
|
||||
strings.HasPrefix(m.Control, "rtsps://") {
|
||||
ur, err := url.Parse(m.Control)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@@ -39,9 +39,18 @@ func TestMediaURL(t *testing.T) {
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:rtsp://localhost/path/trackID=7"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/"),
|
||||
mustParseURL("rtsp://myuser:mypass@192.168.1.99:554/path/trackID=7"),
|
||||
},
|
||||
{
|
||||
"absolute control rtsps",
|
||||
[]byte("v=0\r\n" +
|
||||
"m=video 0 RTP/AVP 96\r\n" +
|
||||
"a=rtpmap:96 H264/90000\r\n" +
|
||||
"a=control:rtsps://localhost/path/trackID=7"),
|
||||
mustParseURL("rtsps://myuser:mypass@192.168.1.99:554/"),
|
||||
mustParseURL("rtsps://myuser:mypass@192.168.1.99:554/path/trackID=7"),
|
||||
},
|
||||
{
|
||||
"relative control",
|
||||
[]byte("v=0\r\n" +
|
||||
|
Reference in New Issue
Block a user