android - 多个 Libstreaming 流仅被识别为第一个 RTSP 客户端的 session

标签 android session video-streaming rtsp live555

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

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

  2. 其他 VLC(也包括 RTSP 客户端)只显示其框架 显示在第一个 VLC 视频窗口中。

此问题发生在指定的RTSP服务器上,但其他网络摄像机没有。

live555如何判断RTSP数据帧属于哪个session

我发现问题可能在以下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 请求中。

起初,我认为我可以将“ session :”之后的硬编码 session ID (1185d20035702ca) 变为动态,然后问题解决了,但是我修改之后,问题依旧

通过Wireshark验证session id修改成功

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

最佳答案

libstreaming 硬编码了视频的目标端口

video.setDestinationPorts(5006);

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

希望能帮助您解决问题。

关于android - 多个 Libstreaming 流仅被识别为第一个 RTSP 客户端的 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27058706/

相关文章:

PHP 对象保存

javascript - Node.js/Express - 如何通过方法(使用套接字)访问 session 数据?

java - 开发网络摄像头聊天应用程序

video - HLS - ffmpeg 失败,无法为输出文件 #0 写入 header (编解码器参数不正确?): No such file or directory

android - ActionBarSherlock 在 Android 2.3.3 上不显示任何内容

android - 为什么它会提示找不到一个库,即使我已经包含了它?

Android alarmmanager 不是很可靠

Android gradle构建时间呈指数增长

android - 在 Google Glass 上使用 libstreaming 时找不到 Stsd 框

java - 销毁 session