Skip to content

Commit

Permalink
server: fix SETUP in case of no track ID and query parameters (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Sep 15, 2024
1 parent 28f9163 commit 6ed93de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server_play_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down
3 changes: 3 additions & 0 deletions server_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6ed93de

Please sign in to comment.