Skip to content

Commit 3954a55

Browse files
committed
Fix extra slash for RTSP SETUP #1236
1 parent b693492 commit 3954a55

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pkg/rtsp/client.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,11 @@ func (c *Conn) SetupMedia(media *core.Media) (byte, error) {
237237
rawURL := media.ID // control
238238
if !strings.Contains(rawURL, "://") {
239239
rawURL = c.URL.String()
240-
if !strings.HasSuffix(rawURL, "/") {
240+
// prefix check for https://github.com/AlexxIT/go2rtc/issues/1236
241+
if !strings.HasSuffix(rawURL, "/") && !strings.HasPrefix(media.ID, "/") {
241242
rawURL += "/"
242243
}
243244
rawURL += media.ID
244-
} else if strings.HasPrefix(rawURL, "rtsp://rtsp://") {
245-
// fix https://github.com/AlexxIT/go2rtc/issues/830
246-
rawURL = rawURL[7:]
247245
}
248246
trackURL, err := urlParse(rawURL)
249247
if err != nil {

pkg/rtsp/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func findFmtpLine(payloadType uint8, descriptions []*sdp.MediaDescription) strin
117117
// 1. Content-Base: rtsp://::ffff:192.168.1.123/onvif/profile.1/
118118
// 2. Content-Base: rtsp://rtsp://turret2-cam.lan:554/stream1/
119119
func urlParse(rawURL string) (*url.URL, error) {
120+
// fix https://github.com/AlexxIT/go2rtc/issues/830
120121
if strings.HasPrefix(rawURL, "rtsp://rtsp://") {
121122
rawURL = rawURL[7:]
122123
}

0 commit comments

Comments
 (0)