diff --git a/pkg/rtsp/client.go b/pkg/rtsp/client.go index 352c00a1..7fc134fc 100644 --- a/pkg/rtsp/client.go +++ b/pkg/rtsp/client.go @@ -237,13 +237,11 @@ func (c *Conn) SetupMedia(media *core.Media) (byte, error) { rawURL := media.ID // control if !strings.Contains(rawURL, "://") { rawURL = c.URL.String() - if !strings.HasSuffix(rawURL, "/") { + // prefix check for https://github.com/AlexxIT/go2rtc/issues/1236 + if !strings.HasSuffix(rawURL, "/") && !strings.HasPrefix(media.ID, "/") { rawURL += "/" } rawURL += media.ID - } else if strings.HasPrefix(rawURL, "rtsp://rtsp://") { - // fix https://github.com/AlexxIT/go2rtc/issues/830 - rawURL = rawURL[7:] } trackURL, err := urlParse(rawURL) if err != nil { diff --git a/pkg/rtsp/helpers.go b/pkg/rtsp/helpers.go index 952730bb..d8ed1685 100644 --- a/pkg/rtsp/helpers.go +++ b/pkg/rtsp/helpers.go @@ -117,6 +117,7 @@ func findFmtpLine(payloadType uint8, descriptions []*sdp.MediaDescription) strin // 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) { + // fix https://github.com/AlexxIT/go2rtc/issues/830 if strings.HasPrefix(rawURL, "rtsp://rtsp://") { rawURL = rawURL[7:] }