【问题标题】:Multiple Libstreaming streams only recognized as session of First RTSP client多个 Libstreaming 流仅被识别为第一个 RTSP 客户端的会话
【发布时间】:2014-11-21 10:03:47
【问题描述】:

我使用 Live555 作为 RTSP 客户端 从 android LibStreaming MajorKernelPanic 服务器获取 RTSP H264 视频流。我面临的问题是显示来自上述类型的 android RTSP 服务器的多个视频流,该服务器由不同的 RTSP 客户端处理。问题显然是如果使用 VLC 也通过 Live555 获得 RTSP H264 帧。

  1. 第一个 VLC(RTSP 客户端)正确显示视频。

  2. 其他 VLC(也包括 RTSP 客户端)不显示任何内容,但其框架是 显示在第一个 VLC 视频窗口中。

此问题发生在指定的 RTSP 服务器上,而不是其他 IP 摄像机。

不知live555如何判断RTSP数据帧属于哪个会话。

我发现问题可能在Libstreaming的以下代码中发现。

        response.attributes = "Transport: RTP/AVP/UDP;"
                +(InetAddress.getByName(destination).isMulticastAddress()?"multicast":"unicast")
                +";destination="+mSession.getDestination()+
                ";client_port="+p1+"-"+p2+
                ";server_port="+src[0]+"-"+src[1]+
                ";ssrc="+Integer.toHexString(ssrc)+
                ";mode=play\r\n" +
                "Session: "+ "1185d20035702ca" + "\r\n" +
                "Cache-Control: no-cache\r\n";

在RTSP服务器的SETUP响应中

    else if (request.method.equalsIgnoreCase("PLAY")) {
        String requestAttributes = "RTP-Info: ";
        if (mSession.trackExists(0)) requestAttributes += "url=rtsp://"+mClient.getLocalAddress().getHostAddress()+":"+mClient.getLocalPort()+"/trackID="+0+";seq=0,";
        if (mSession.trackExists(1)) requestAttributes += "url=rtsp://"+mClient.getLocalAddress().getHostAddress()+":"+mClient.getLocalPort()+"/trackID="+1+";seq=0,";
        requestAttributes = requestAttributes.substring(0, requestAttributes.length()-1) 
                            + "\r\nSession: 1185d20035702ca\r\n";

在 PLAY 请求中。

起初,我认为我可以将“会话:”之后的硬编码 会话 ID (1185d20035702ca) 设置为 dynamic 然后问题解决了,但是我改了之后,问题依旧存在

通过Wireshark验证session id变更成功。

欢迎任何相关建议。谢谢。

【问题讨论】:

    标签: android session video-streaming rtsp live555


    【解决方案1】:

    libstreaming 硬编码视频的目标端口

    video.setDestinationPorts(5006);
    

    你只需要让它变成变量来支持多个实例。

    希望能帮助您解决问题。

    【讨论】:

      猜你喜欢
      • 2015-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-14
      • 2014-02-23
      • 2015-07-08
      • 1970-01-01
      相关资源
      最近更新 更多