Merge pull request #399 from nikmu/wvp-28181-2.0
修复device_channel的Id改变带来的tree查询bug
| | |
| | | return request;
|
| | | }
|
| | |
|
| | | public Request createInfoRequest(Device device, StreamInfo streamInfo, String content, Long cseq)
|
| | | public Request createInfoRequest(Device device, StreamInfo streamInfo, String content)
|
| | | throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
| | | Request request = null;
|
| | | if (streamInfo == null) return null;
|
| | |
| | |
|
| | | // Forwards
|
| | | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
|
| | | if (cseq == null) {
|
| | | cseq = redisCatchStorage.getCSEQ(Request.INFO);
|
| | | }
|
| | |
|
| | | cseq = redisCatchStorage.getCSEQ(Request.INVITE);
|
| | | // ceq
|
| | | CSeqHeader cSeqHeader = sipFactory.createHeaderFactory()
|
| | | .createCSeqHeader(cseq, Request.INFO);
|
| | |
| | | content.append("PAUSE RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("PauseTime: now\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) {
|
| | | return;
|
| | | }
|
| | |
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=now-\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | |
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n");
|
| | |
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | |
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | |
| | | /** |
| | | * 主键ID |
| | | */ |
| | | protected int id; |
| | | protected String channelId; |
| | | |
| | | /** |
| | | * 父节点ID |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | | |
| | | @Override |
| | | public String getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(String parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | private Object content; |
| | | |
| | | public ForestNode(int id, String parentId, Object content) { |
| | | this.id = id; |
| | | public ForestNode(String id, String parentId, Object content) { |
| | | this.channelId = id; |
| | | this.parentId = parentId; |
| | | this.content = content; |
| | | } |
| | |
| | | /** |
| | | * 森林的所有节点 |
| | | */ |
| | | private final ImmutableMap<Integer, T> nodeMap; |
| | | private final ImmutableMap<String, T> nodeMap; |
| | | |
| | | /** |
| | | * 森林的父节点ID |
| | | */ |
| | | private final Map<Integer, Object> parentIdMap = Maps.newHashMap(); |
| | | private final Map<String, Object> parentIdMap = Maps.newHashMap(); |
| | | |
| | | public ForestNodeManager(List<T> nodes) { |
| | | nodeMap = Maps.uniqueIndex(nodes, INode::getId); |
| | | nodeMap = Maps.uniqueIndex(nodes, INode::getChannelId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @param parentId 父节点ID |
| | | */ |
| | | public void addParentId(int parentId) { |
| | | public void addParentId(String parentId) { |
| | | parentIdMap.put(parentId, ""); |
| | | } |
| | | |
| | |
| | | public List<T> getRoot() { |
| | | List<T> roots = new ArrayList<>(); |
| | | nodeMap.forEach((key, node) -> { |
| | | if (node.getParentId() == null || parentIdMap.containsKey(node.getId())) { |
| | | if (node.getParentId() == null || parentIdMap.containsKey(node.getChannelId())) { |
| | | roots.add(node); |
| | | } |
| | | }); |
| | |
| | | if (node != null) { |
| | | node.getChildren().add(forestNode); |
| | | } else { |
| | | forestNodeManager.addParentId(forestNode.getId()); |
| | | forestNodeManager.addParentId(forestNode.getChannelId()); |
| | | } |
| | | } |
| | | }); |
| | |
| | | items.forEach(forestNode -> { |
| | | if (forestNode.getParentId() != null) { |
| | | INode<T> node = forestNodeManager.getTreeNodeAt(forestNode.getParentId()); |
| | | if (CollectionUtil.contains(parentIds, forestNode.getId())){ |
| | | forestNodeManager.addParentId(forestNode.getId()); |
| | | if (CollectionUtil.contains(parentIds, forestNode.getChannelId())){ |
| | | forestNodeManager.addParentId(forestNode.getChannelId()); |
| | | } else { |
| | | if (node != null){ |
| | | node.getChildren().add(forestNode); |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | int getId(); |
| | | String getChannelId(); |
| | | |
| | | /** |
| | | * 父主键 |