diff --git a/server_play_test.go b/server_play_test.go index 7e95bc58..f54c354e 100644 --- a/server_play_test.go +++ b/server_play_test.go @@ -198,6 +198,18 @@ func TestServerPlayPath(t *testing.T) { "rtsp://localhost:8554/teststream/", "/teststream", }, + { + "without media id, query, ffmpeg", + "rtsp://localhost:8554/teststream?testing=123/", + "rtsp://localhost:8554/teststream/", + "/teststream", + }, + { + "without media id, query, gstreamer", + "rtsp://localhost:8554/teststream/?testing=123", + "rtsp://localhost:8554/teststream/", + "/teststream", + }, { "subpath", "rtsp://localhost:8554/test/stream[control]", diff --git a/server_session.go b/server_session.go index ad645f8b..f86458a7 100644 --- a/server_session.go +++ b/server_session.go @@ -73,6 +73,9 @@ func getPathAndQueryAndTrackID(u *base.URL) (string, string, string, error) { // no track ID and a trailing slash. // this happens when trying to read a MPEG-TS stream with FFmpeg. + if strings.HasSuffix(u.RawQuery, "/") { + return u.Path, u.RawQuery[:len(u.RawQuery)-1], "0", nil + } if strings.HasSuffix(u.Path[1:], "/") { return u.Path[:len(u.Path)-1], u.RawQuery, "0", nil }