Skip to content

Commit 92e915c

Browse files
committed
server: fix SETUP in case of no track ID and query parameters
1 parent 72e74f3 commit 92e915c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

server_play_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,18 @@ func TestServerPlayPath(t *testing.T) {
198198
"rtsp://localhost:8554/teststream/",
199199
"/teststream",
200200
},
201+
{
202+
"without media id, query, ffmpeg",
203+
"rtsp://localhost:8554/teststream?testing=123/",
204+
"rtsp://localhost:8554/teststream/",
205+
"/teststream",
206+
},
207+
{
208+
"without media id, query, gstreamer",
209+
"rtsp://localhost:8554/teststream/?testing=123",
210+
"rtsp://localhost:8554/teststream/",
211+
"/teststream",
212+
},
201213
{
202214
"subpath",
203215
"rtsp://localhost:8554/test/stream[control]",

server_session.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ func getPathAndQueryAndTrackID(u *base.URL) (string, string, string, error) {
7373

7474
// no track ID and a trailing slash.
7575
// this happens when trying to read a MPEG-TS stream with FFmpeg.
76+
if strings.HasSuffix(u.RawQuery, "/") {
77+
return u.Path, u.RawQuery[:len(u.RawQuery)-1], "0", nil
78+
}
7679
if strings.HasSuffix(u.Path[1:], "/") {
7780
return u.Path[:len(u.Path)-1], u.RawQuery, "0", nil
7881
}

0 commit comments

Comments
 (0)