我使用Live555作为RTSP客户端,从android LibStreaming MajorKernelPanic服务器获取RTSP H264视频流。我面临的问题是显示一个以上的视频流从上述类型的android RTSP服务器,这是由不同的RTSP客户端处理。问题很明显,如果使用VLC,通过Live555也可以得到RTSP的H264帧。
此问题发生在指定的RTSP服务器上,而不是其他IP摄像机上。
我想知道live555如何确定RTSP数据框架属于哪个会话。
我发现这个问题可能在下面的立流代码中暴露出来。
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服务器和
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";在游戏中请求。
一开始,我以为我可以在“会话:”之后设置硬编码的会话ID (1185d20035702ca),然后问题就解决了,但是在我更改了它之后,问题仍然存在,。
Wireshark验证了会话id的成功更改。
欢迎任何相关建议。谢谢。
发布于 2014-11-28 15:48:35
hardcoded硬编码视频的目标端口
video.setDestinationPorts(5006);您只需要使它成为变量,以支持多个实例。
希望能帮助你解决问题。
https://stackoverflow.com/questions/27058706
复制相似问题