RTSP:RTP使用与RTSP相同的端口

发布于 2025-01-27 05:39:30 字数 1591 浏览 2 评论 0 原文

这确实不是问题,但我想从社区那里听到这种“奇怪”现象,或者至少在我看来。

我编写了一个RTSP应用程序,该应用程序将视频和音频流式传输(分别为RTP有效载荷96和97)

RTSP客户端进行连接,设置并正确播放(可以在客户端端看到视频)。我想的是RTP(视频和音频)通过TCP(通过端口554)发送。是的,我知道它的正确行为,但我很困惑它使用与RTSP相同的端口(端口554)。我一直认为RTSP将具有静态端口号,并且在建立RTSP连接后,客户端将与服务器协商RTP/RTCP连接(这将导致创建其他端口(在我的情况下为4)。似乎所有的RTP/RTSP/RTCP流量都通过同一端口(或我误解了结果),

下面是Wireshark捕获的RTSP事务,

C->S (video payload)
SETUP rtsp://192.168.22.33:554/MOVIE/stream=0 RTSP/1.0
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
User-Agent: happytimesoft rtsp client

S->C (video payload ok)
RTSP/1.0 200 OK
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=7C0EAE5B;mode="PLAY"
Server: GStreamer RTSP server
Session: -8lIe87._f3qX4.h
Date: Wed, 24 Mar 2021 15:23:22 GMT

C->S (audio payload)
SETUP rtsp://192.168.22.33:554/MOVIE/stream=1 RTSP/1.0
CSeq: 4
Session: -8lIe87._f3qX4.h
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
User-Agent: happytimesoft rtsp client

S->C (audio payload)
RTSP/1.0 200 OK
CSeq: 4
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=2E0ECCA6;mode="PLAY"
Server: GStreamer RTSP server
Session: -8lIe87._f3qX4.h
Date: Wed, 24 Mar 2021 15:23:22 GMT

C->S
PLAY rtsp://192.168.22.33:554/MOVIE/ RTSP/1.0
CSeq: 5
Session: -8lIe87._f3qX4.h
Range: npt=0.000-
User-Agent: happytimesoft rtsp client

然后将两个有效载荷与一个端口一起播放到一个端口

我的解释是正确的

? /rfc/rfc2326.txt“ rel =” nofollow noreferrer“> https://www.rfc-editor.org/rfc/rfc/rfc2326.txt

It really isn't a problem but I would like to hear from the community about this "strange" phenomenon or at least it seems to me.

I have written an RTSP application that streams video and audio (as RTP payload 96 and 97 respectively)

RTSP client make connection and setup and play correctly (the video could be seen over the client end). What I am bother about is that RTP (video and audio) is send out through TCP (through port 554). Yah I know its correct behaviour but I quite confuse that it uses the same port as RTSP (port 554). I have always have the idea that RTSP would have a static port number and after RTSP connection is established, client would then negotiate the RTP/RTCP connection with server (which will results in creation of additional port (4 in my case). However, it seem that all RTP/RTSP/RTCP traffic is tunneled through the same port (or I have misinterpreted the result)

Below is the rtsp transaction captured by wireshark

C->S (video payload)
SETUP rtsp://192.168.22.33:554/MOVIE/stream=0 RTSP/1.0
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
User-Agent: happytimesoft rtsp client

S->C (video payload ok)
RTSP/1.0 200 OK
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=7C0EAE5B;mode="PLAY"
Server: GStreamer RTSP server
Session: -8lIe87._f3qX4.h
Date: Wed, 24 Mar 2021 15:23:22 GMT

C->S (audio payload)
SETUP rtsp://192.168.22.33:554/MOVIE/stream=1 RTSP/1.0
CSeq: 4
Session: -8lIe87._f3qX4.h
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
User-Agent: happytimesoft rtsp client

S->C (audio payload)
RTSP/1.0 200 OK
CSeq: 4
Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=2E0ECCA6;mode="PLAY"
Server: GStreamer RTSP server
Session: -8lIe87._f3qX4.h
Date: Wed, 24 Mar 2021 15:23:22 GMT

C->S
PLAY rtsp://192.168.22.33:554/MOVIE/ RTSP/1.0
CSeq: 5
Session: -8lIe87._f3qX4.h
Range: npt=0.000-
User-Agent: happytimesoft rtsp client

After which it plays with both of the payload into one port

Package played

Is my interpretation correct? Is there any problem of sending all communication via one port (albeit latency)? Or is there any chances that the packets might be rerouted?

Thanks

https://www.rfc-editor.org/rfc/rfc2326.txt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遥远的绿洲 2025-02-03 05:39:30

RTSP/RTP具有多种发送模式。您的客户端明确请求RTSP交织 - 在RTSP频道中,RTP数据被发送交错。这是防火墙受限环境的不错的后备。如果您不要求此RTP渠道,则应通过其单独的UDP端口发送。

RTSP/RTP has several sending modes. Your client explicitly requests for RTSP interleaving - where RTP data gets send interleaved in the RTSP channel. That a nice fallback for firewall restricted environments. If you don't request this RTP channels should be send over their individual UDP ports.

薄凉少年不暖心 2025-02-03 05:39:30

它使用TCP的原因(您的主要关注点)是因为它使用TCP是在此尝试顺序中使用默认值: tcp+udp-mcast+udp https://gredesktop..freedesktop.org.org/documentation/rtspssp/rtsps/rtsps/rtspsprc.htspsrc.htspsrsprot

a通过设置 RTSPRC 参数协议 gst_rtsp_lower_trans_trans_udp 来强制UDP。或 GST-Launch-1.0 - > 协议= 1

Reason it uses TCP (your main concern) is that it uses TCP is that the default is in this trying order: tcp+udp-mcast+udp: https://gstreamer.freedesktop.org/documentation/rtsp/rtspsrc.html#rtspsrc:protocols

You can force UDP by setting the rtspsrc parameter protocols to GST_RTSP_LOWER_TRANS_UDP. Or in gst-launch-1.0 -> protocols=1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文