mirror of
https://github.com/aler9/gortsplib
synced 2025-10-01 13:32:23 +08:00
server: fix SETUP in case of no track ID and query parameters (#623)
This commit is contained in:
@@ -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]",
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user