Multiple Libstreaming streams only recognized as session of First RTSP client

我的梦境 提交于 2019-12-11 07:49:29

问题


I am using Live555 as RTSP client to get the RTSP H264 video stream from android LibStreaming MajorKernelPanic server. I am facing the problem to display more than one video streams from the mentioned type android RTSP server which is handled by different RTSP client. The problem is obviously if using VLC which get the RTSP H264 frame via Live555 also.

  1. The first VLC (RTSP client) displays video correctly.

  2. The other VLCs (RTSP client also) display nothing but its frame is displayed in the first VLC video window.

This problem is happened on the specified RTSP server but not other IP camera.

I wonder how live555 can determine the RTSP data frame is belongs to which session.

I found the problem might be revealed in following code of 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";

in SETUP response of RTSP server and

    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";

in PLAY request.

At first, I thought I can make the hardcoded session ID (1185d20035702ca) after the "Session: " to dynamic one then the problem solved, but after I changed it, the problem still remains there.

The success change of the session id is verified by Wireshark.

Any related suggestion is welcomed. Thanks.


回答1:


The libstreaming hardcoded the destination port for Video

video.setDestinationPorts(5006);

You just need to make it become variable to support multiple instance.

Hope can help you solve your problem.



来源:https://stackoverflow.com/questions/27058706/multiple-libstreaming-streams-only-recognized-as-session-of-first-rtsp-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!