Open XDGFX opened 2 months ago
Hello, i can confirm that there's a bug, but it's on the GStreamer side, since in RTSP the control attribute (stream=0) should be appended AFTER query parameters (key=value), not merged with query parameters.
This is the (wrong) request that GStreamer sends when publishing:
SETUP rtsp://127.0.0.1:8554/mystream/stream=0?key=value RTSP/1.0
This is the right one:
SETUP rtsp://127.0.0.1:8554/mystream?key=value/stream=0 RTSP/1.0
The problem is that this split between query parameters and control attribute is not mentioned in the specification, it's an unwritten rule of RTSP that is implemented anywhere nonetheless. Except GStreamer, evidently. Thus i doubt that GStreamer maintainers would accept a patch.
Which version are you using?
v1.8.0
Which operating system are you using?
Describe the issue
When attempting to stream video with RTSP (using Gstreamer), response 400 is given on SETUP request.
Describe how to replicate the issue
gst-launch-1.0 videotestsrc ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! x264enc speed-preset=veryfast tune=zerolatency bitrate=800 ! rtspclientsink protocols=tcp location=rtsp://127.0.0.1:8554/mystream
gst-launch-1.0 videotestsrc ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! x264enc speed-preset=veryfast tune=zerolatency bitrate=800 ! rtspclientsink protocols=tcp location=rtsp://127.0.0.1:8554/mystream?key=value
Error (400): Bad Request
Logs
Logs from server:
``` 2024/04/25 12:04:25 INF [RTSP] [conn 192.168.65.1:25173] opened 2024/04/25 12:04:25 DEB [RTSP] [conn 192.168.65.1:25173] [c->s] OPTIONS rtsp://127.0.0.1:8554/mystream?key=value RTSP/1.0 CSeq: 1 Date: Thu, 25 Apr 2024 12:04:25 GMT User-Agent: GStreamer/1.22.10 2024/04/25 12:04:25 DEB [RTSP] [conn 192.168.65.1:25173] [s->c] RTSP/1.0 200 OK CSeq: 1 Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN Server: gortsplib 2024/04/25 12:04:25 DEB [RTSP] [conn 192.168.65.1:25173] [c->s] ANNOUNCE rtsp://127.0.0.1:8554/mystream?key=value RTSP/1.0 CSeq: 2 Content-Length: 472 Content-Type: application/sdp Date: Thu, 25 Apr 2024 12:04:25 GMT User-Agent: GStreamer/1.22.10 v=0 o=- 3559535198 1 IN IP4 127.0.0.1 s=Session streamed with GStreamer i=rtspclientsink t=0 0 a=tool:GStreamer m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:819 a=rtpmap:96 H264/90000 a=framerate:30 a=fmtp:96 packetization-mode=1;sprop-parameter-sets=Z/QAHpDZaAoD2wFqDAwMgAAAAwCAAAAeR4sXUA==,aO8xkhk=;profile-level-id=f4001e;level-asymmetry-allowed=1 a=control:stream=0 a=ts-refclk:local a=mediaclk:sender a=ssrc:1080323934 cname:user668979404@host-d08b337a 2024/04/25 12:04:25 INF [RTSP] [session 7df37126] created by 192.168.65.1:25173 2024/04/25 12:04:25 DEB [path mystream] created 2024/04/25 12:04:25 DEB [RTSP] [conn 192.168.65.1:25173] [s->c] RTSP/1.0 200 OK CSeq: 2 Server: gortsplib 2024/04/25 12:04:25 DEB [RTSP] [conn 192.168.65.1:25173] [c->s] SETUP rtsp://127.0.0.1:8554/mystream/stream=0?key=value RTSP/1.0 CSeq: 3 Date: Thu, 25 Apr 2024 12:04:25 GMT Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=RECORD User-Agent: GStreamer/1.22.10 2024/04/25 12:04:26 DEB [RTSP] [conn 192.168.65.1:25173] [s->c] RTSP/1.0 400 Bad Request CSeq: 3 Server: gortsplib 2024/04/25 12:04:26 INF [RTSP] [conn 192.168.65.1:25173] closed: media not found 2024/04/25 12:04:26 DEB [path mystream] destroyed: not in use 2024/04/25 12:04:26 INF [RTSP] [session 7df37126] destroyed: not in use ```It seems fine until Gstreamer tries to send data to the
/mystream/stream=0
endpoint.Additional info
The reason I need to send a query parameter is for JWT authentication; as specified in the docs I am trying to send
jwt=...
, however the process fails as described above.Did you attach the server logs?
yes
Did you attach a network dump?
no