You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GStreamer通过WebRTC转发RTSP流时的延迟警告问题求助

GStreamer WebRTC转发RTSP流时消除延迟警告的方法

你在使用GStreamer将RTSP流通过WebRTC转发时,持续收到大量警告:

Can't determine running time for this packet without knowing configured latency

所用管道为:

rtspsrc location=my_rtsp_url is-live=true ! 
queue ! 
decodebin ! 
videoconvert ! 
openh264enc ! 
video/x-h264,profile=constrained-baseline ! 
rtph264pay aggregate-mode=zero-latency ! 
webrtcbin turn-server=turn://test:test@localhost:3478 bundle-policy=max-bundle name=webrtcbin

查看GStreamer源码发现RTP会话(gstrtpsession.c)中send_latency为GST_CLOCK_TIME_NONE,需要通过管道配置解决该问题。

解决方案

  • 在webrtcbin元素上添加latency属性,指定一个合理的延迟值(例如200毫秒)。修改后的管道如下:
rtspsrc location=my_rtsp_url is-live=true ! 
queue ! 
decodebin ! 
videoconvert ! 
openh264enc ! 
video/x-h264,profile=constrained-baseline ! 
rtph264pay aggregate-mode=zero-latency ! 
webrtcbin latency=200 turn-server=turn://test:test@localhost:3478 bundle-policy=max-bundle name=webrtcbin
  • 原理:webrtcbin内部会管理RTP会话,设置latency属性会将对应的值传递给RTP会话模块,使其能正确计算数据包的运行时间,从而消除警告。对于直播流场景,200ms是比较合理的起始值,你可以根据实际网络状况调整这个数值。

内容的提问来源于stack exchange,提问作者Dan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 07:50:25