无法将 Kurento KMS 连接到 RTSP 多播 URI

Cannot connect Kurento KMS to a RTSP Multicast URI

使用 Kurento 媒体服务器 (KMS) 版本 6.6.0 部署 Docker 使用以下图片来自 Docker 集线器:kurento/kurento-media-server:6.6.0

已学习教程Docs » Kurento Tutorials » Java - Player

KMS 版本6.6.0

Version: 6.6.0
Found modules:
        Module: 'core' version '6.6.0'
        Module: 'elements' version '6.6.0'
        Module: 'filters' version '6.6.0'

其他库版本:

ii  gstreamer1.5-libav:amd64             1.8.2.1~20160909143244.96.g493eee4.trusty  amd64        libav plugin for GStreamer
ii  gstreamer1.5-nice:amd64              0.1.13.1~20160909144510.80.gd9ef50e.trusty amd64        ICE library (GStreamer plugin)
ii  gstreamer1.5-plugins-bad:amd64       1.8.1.1~20160909144557.99.gf836e53.trusty  amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.5-plugins-base:amd64      1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-good:amd64      1.8.1.1~20160909143047.112.g9ee4248.trusty amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-ugly:amd64      1.8.1.1~20160909192513.89.g2685b0f.trusty  amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.5-pulseaudio:amd64        1.8.1.1~20160909143047.112.g9ee4248.trusty amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.5-x:amd64                 1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer plugins for X11 and Pango
ii  kms-core-6.0                         6.6.0.20160909201132.trusty                amd64        Kurento core module
ii  kms-elements-6.0                     6.6.0.20160912112100.trusty                amd64        Kurento elements module
ii  kms-filters-6.0                      6.6.0.20160912114031.trusty                amd64        Kurento filters module
ii  kms-jsonrpc-1.0                      1.1.1.trusty                               amd64        Kurento jsonrpc library
ii  kmsjsoncpp                           1.6.3~20160909143252.40.gd78deb7.trusty    amd64        Kurento jsoncpp library
ii  kurento-media-server-6.0             6.6.0.20160912115811.trusty                amd64        Kurento Media Server
ii  libgstreamer-plugins-bad1.5-0:amd64  1.8.1.1~20160909144557.99.gf836e53.trusty  amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer-plugins-base1.5-0:amd64 1.8.1.1~20160909142623.55.g7b19cfd.trusty  amd64        GStreamer libraries from the "base" set
ii  libgstreamer1.5-0:amd64              1.8.1.1~20160909144007.170.g0d6031b.trusty amd64        Core GStreamer libraries and elements
ii  libnice10:amd64                      0.1.13.1~20160909144510.80.gd9ef50e.trusty amd64        ICE library (shared library)

客户端库

  1. 应用服务器(后端)

    • 语言:Java
    • 版本:6.9.0
<dependency>
    <groupId>org.kurento</groupId>
    <artifactId>kurento-client</artifactId>
    <version>6.9.0</version>
</dependency>
  1. Kurento-utils(前端)

    • 语言:Java脚本(前端)
    • 版本:6.9.0 "kurento-utils": "^6.9.0"

当我尝试通过 RTSP MULTICAST 将“PlayerEndpoint”连接到网络摄像机时,例如:rtsp://xxxxx:xxxxx@xxx.xxx.xxx.xxx?multicast=1

KMS returns 出现以下错误:

Log KMS v6.6.0 Connection Kurento IP camera Multicast

特别注意行:

kms2       | 0:04:34.165887894     1 0x7fe214002230 DEBUG                rtspsrc gstrtspsrc.c:7553:gst_rtspsrc_handle_message:<source> timeout on UDP port

I can play RTSP UNICAST streams but not MULTICAST

我也按照这个步骤来检查这是否不是网络问题。

gst-launch-1.0 rtspsrc location="rtsp://xxxxx:xxxxx@xxx.xxx.xxx.xxx?multicast=1" ! decodebin ! autovideosink

这里是 Wireshark 打包的结果:

Pay attention to the Wireshark trace with protocol IGMPv2, i notice that Kurento is not using this protocol.

遵循此文档:

https://doc-kurento.readthedocs.io/en/6.9.0/dev/dev_guide.html#add-kurento-repository

我能够通过以下方式执行 gst-launch-1.5 命令:

gst-launch-1.5 rtspsrc location =" rtsp://xxxxx:xxxxx@xxx.xxx.xxx.xxx/?multicast=1"! Decodebin! autovideosink

然后结果和预期的一样,视频可以在MULTICAST中播放没有问题。

在此之后我发现了以下 post:

How to support multicast network in Docker

然后我可以验证错误来自Docker,特别是它的网络配置。

这个问题的解决方法是在Docker中通过以下方式暴露KMS服务 Compose with:

network_mode: host

version: "3.7"
services:
  kms:
    image: kurento/kurento-media-server:6.9.0
    container_name: kms
    restart: always
    network_mode: host
    environment:
      - GST_DEBUG=2,Kurento*:5