[FFmpeg-devel] libavformat/rtsp.c: fix RTSP not setup the UDP stream in SDP

"zhilizhao(赵志立)" quinkblack at foxmail.com
Fri Jul 30 09:57:28 EEST 2021



> On Jul 30, 2021, at 10:55 AM, Chiu, Yung-Hsiang <mirror.tw at gmail.com> wrote:
> 
> Hi,
> 
> Our RTSP video server reply two streams in SDP are UDP and RTP/AVP/UDP.
>>> m=video 0 UDP 33
>>> m=video 0 RTP/AVP/UDP 33
> 
> ffmpeg now setup twice with the same transport "RTP/AVP/UDP"
> 
> The first time is
>>> SETUP rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
>>> Transport: RTP/AVP/UDP;unicast;client_port=26972-26973
> 
> And the second time is
>>> SETUP rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
>>> Transport: RTP/AVP/UDP;unicast;client_port=26974-26975
> 
> After reviewing the rtsp.c, I found the bug is caused by the
> acceptable string in sdp_parse_line() is "udp" only.

From RFC 4566, the protocol should be specified as “udp”:

https://datatracker.ietf.org/doc/html/rfc4566#section-8.2.2

From IANA, “UDP” is not a registered protocol field of SDP: 
https://www.iana.org/assignments/sdp-parameters/sdp-parameters.xhtml

Is there any reference that the field can be uppercase? I want figure out
whether it’s a bug of FFmpeg, or a bug of the server. I don’t object the
patch, but the patch commit message should reflect the difference between
‘fix bug of FFmpeg’ vs ‘workaround buggy server'.

> 
> The transport with "udp" or "UDP" should be acceptable in sdp_parse_line().
> 
> The full rtsp negotiation is shown below.
> 
> OPTIONS rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
> CSeq: 1
> User-Agent: Lavf58.35.101
> 
> RTSP/1.0 200 OK
> Server: Orbit2x
> CSeq: 1
> Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER
> 
> 
> DESCRIBE rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
> Accept: application/sdp
> CSeq: 2
> User-Agent: Lavf58.35.101
> 
> 
> RTSP/1.0 200 OK
> Server: Orbit2x
> CSeq: 2
> Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER
> Content-Type: application/sdp
> Content-Length: 179
> 
> v=0
> o=- 60596 0 IN IP4 192.168.1.100
> s=RTSP Session
> t=0 0
> c=IN IP4 192.168.1.100
> b=AS:7984.000
> a=type:vod
> a=range:npt=0-5313
> m=video 0 UDP 33
> m=video 0 RTP/AVP/UDP 33
> 
> SETUP rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
> Transport: RTP/AVP/UDP;unicast;client_port=26972-26973
> CSeq: 3
> User-Agent: Lavf58.35.101
> 
> RTSP/1.0 200 OK
> Server: Orbit2x
> CSeq: 3
> Session: 728680355;timeout=60
> Transport: RTP/AVP/UDP;unicast;destination=192.168.2.184;client_port=26972;source=192.168.1.100;server_port=10000-10001;ssrc=7b9507dd
> 
> SETUP rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
> Transport: RTP/AVP/UDP;unicast;client_port=26974-26975
> CSeq: 4
> User-Agent: Lavf58.35.101
> Session: 728680355
> 
> RTSP/1.0 200 OK
> Server: Orbit2x
> CSeq: 4
> Session: 728680355;timeout=60
> Transport: RTP/AVP/UDP;unicast;destination=192.168.2.184;client_port=26974;source=192.168.1.100;server_port=10000-10001;ssrc=7b9507dd
> 
> PLAY rtsp://192.168.1.100:554/MOV_000012353521.mpg RTSP/1.0
> Range: npt=0.000-
> CSeq: 5
> User-Agent: Lavf58.35.101
> Session: 728680355
> 
> RTSP/1.0 200 OK
> Server: Orbit2x
> CSeq: 5
> Session: 728680355
> Scale: 1.00
> Range: npt=0-
> 
> <0001-libavformat-rtsp.c-fix-RTSP-not-setup-the-UDP-stream.patch>_______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list