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

Chiu, Yung-Hsiang mirror.tw at gmail.com
Fri Jul 30 05:55:52 EEST 2021


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.

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-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavformat-rtsp.c-fix-RTSP-not-setup-the-UDP-stream.patch
Type: text/x-patch
Size: 882 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210730/1d4aa9c6/attachment.bin>


More information about the ffmpeg-devel mailing list