Fix RTSP URL parse bug #208

This commit is contained in:
Alexey Khit
2023-01-26 09:09:48 +03:00
parent 0e28b0c797
commit 2f436bba4e
2 changed files with 16 additions and 3 deletions

View File

@@ -47,9 +47,14 @@ func UnmarshalSDP(rawSDP []byte) ([]*streamer.Media, error) {
return medias, nil
}
// urlParse fix bug in URL from D-Link camera:
// Content-Base: rtsp://::ffff:192.168.1.123/onvif/profile.1/
// urlParse fix bugs:
// 1. Content-Base: rtsp://::ffff:192.168.1.123/onvif/profile.1/
// 2. Content-Base: rtsp://rtsp://turret2-cam.lan:554/stream1/
func urlParse(rawURL string) (*url.URL, error) {
if strings.HasPrefix(rawURL, "rtsp://rtsp://") {
rawURL = rawURL[7:]
}
u, err := url.Parse(rawURL)
if err != nil && strings.HasSuffix(err.Error(), "after host") {
if i1 := strings.Index(rawURL, "://"); i1 > 0 {