Commit 616e1be0b43bc7445bffad63499752f2e568f895
1 parent
2c1dbe63
修复ssrc释放失败问题、修正branch字段以符合国标
Showing
2 changed files
with
20 additions
and
19 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| ... | ... | @@ -15,6 +15,7 @@ import org.springframework.stereotype.Component; |
| 15 | 15 | public class VideoStreamSessionManager { |
| 16 | 16 | |
| 17 | 17 | private ConcurrentHashMap<String, ClientTransaction> sessionMap = new ConcurrentHashMap<>(); |
| 18 | + private ConcurrentHashMap<String, String> ssrcMap = new ConcurrentHashMap<>(); | |
| 18 | 19 | |
| 19 | 20 | public String createPlaySsrc(){ |
| 20 | 21 | return SsrcUtil.getPlaySsrc(); |
| ... | ... | @@ -24,16 +25,18 @@ public class VideoStreamSessionManager { |
| 24 | 25 | return SsrcUtil.getPlayBackSsrc(); |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | - public void put(String ssrc,ClientTransaction transaction){ | |
| 28 | - sessionMap.put(ssrc, transaction); | |
| 28 | + public void put(String streamId,String ssrc,ClientTransaction transaction){ | |
| 29 | + sessionMap.put(streamId, transaction); | |
| 30 | + ssrcMap.put(streamId, ssrc); | |
| 29 | 31 | } |
| 30 | 32 | |
| 31 | - public ClientTransaction get(String ssrc){ | |
| 32 | - return sessionMap.get(ssrc); | |
| 33 | + public ClientTransaction get(String streamId){ | |
| 34 | + return sessionMap.get(streamId); | |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | - public void remove(String ssrc) { | |
| 36 | - sessionMap.remove(ssrc); | |
| 37 | - SsrcUtil.releaseSsrc(ssrc); | |
| 37 | + public void remove(String streamId) { | |
| 38 | + sessionMap.remove(streamId); | |
| 39 | + SsrcUtil.releaseSsrc(ssrcMap.get(streamId)); | |
| 40 | + ssrcMap.remove(streamId); | |
| 38 | 41 | } |
| 39 | 42 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -235,7 +235,7 @@ public class SIPCommander implements ISIPCommander { |
| 235 | 235 | ptzXml.append("</Control>\r\n"); |
| 236 | 236 | |
| 237 | 237 | String tm = Long.toString(System.currentTimeMillis()); |
| 238 | - Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtz" + tm, null); | |
| 238 | + Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null); | |
| 239 | 239 | |
| 240 | 240 | transmitRequest(device, request); |
| 241 | 241 | return true; |
| ... | ... | @@ -272,7 +272,7 @@ public class SIPCommander implements ISIPCommander { |
| 272 | 272 | ptzXml.append("</Control>\r\n"); |
| 273 | 273 | |
| 274 | 274 | String tm = Long.toString(System.currentTimeMillis()); |
| 275 | - Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "ViaPtzBranch", "FromPtz" + tm, null); | |
| 275 | + Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null); | |
| 276 | 276 | transmitRequest(device, request); |
| 277 | 277 | return true; |
| 278 | 278 | } catch (SipException | ParseException | InvalidArgumentException e) { |
| ... | ... | @@ -387,9 +387,7 @@ public class SIPCommander implements ISIPCommander { |
| 387 | 387 | Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrc); |
| 388 | 388 | |
| 389 | 389 | ClientTransaction transaction = transmitRequest(device, request, errorEvent); |
| 390 | - streamSession.put(streamId, transaction); | |
| 391 | - | |
| 392 | - | |
| 390 | + streamSession.put(streamId,ssrc, transaction); | |
| 393 | 391 | |
| 394 | 392 | } catch ( SipException | ParseException | InvalidArgumentException e) { |
| 395 | 393 | e.printStackTrace(); |
| ... | ... | @@ -487,7 +485,7 @@ public class SIPCommander implements ISIPCommander { |
| 487 | 485 | Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null); |
| 488 | 486 | |
| 489 | 487 | ClientTransaction transaction = transmitRequest(device, request, errorEvent); |
| 490 | - streamSession.put(streamId, transaction); | |
| 488 | + streamSession.put(streamId, ssrc, transaction); | |
| 491 | 489 | |
| 492 | 490 | } catch ( SipException | ParseException | InvalidArgumentException e) { |
| 493 | 491 | e.printStackTrace(); |
| ... | ... | @@ -893,7 +891,7 @@ public class SIPCommander implements ISIPCommander { |
| 893 | 891 | catalogXml.append("</Query>\r\n"); |
| 894 | 892 | |
| 895 | 893 | String tm = Long.toString(System.currentTimeMillis()); |
| 896 | - Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaDeviceInfo" + tm, "FromDev" + tm, null); | |
| 894 | + Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaDeviceInfo-" + tm, "FromDev" + tm, null); | |
| 897 | 895 | |
| 898 | 896 | transmitRequest(device, request); |
| 899 | 897 | |
| ... | ... | @@ -923,7 +921,7 @@ public class SIPCommander implements ISIPCommander { |
| 923 | 921 | catalogXml.append("</Query>\r\n"); |
| 924 | 922 | |
| 925 | 923 | String tm = Long.toString(System.currentTimeMillis()); |
| 926 | - Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaCatalog" + tm, "FromCat" + tm, null); | |
| 924 | + Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaCatalog-" + tm, "FromCat" + tm, null); | |
| 927 | 925 | |
| 928 | 926 | transmitRequest(device, request, errorEvent); |
| 929 | 927 | } catch (SipException | ParseException | InvalidArgumentException e) { |
| ... | ... | @@ -958,7 +956,7 @@ public class SIPCommander implements ISIPCommander { |
| 958 | 956 | recordInfoXml.append("</Query>\r\n"); |
| 959 | 957 | |
| 960 | 958 | String tm = Long.toString(System.currentTimeMillis()); |
| 961 | - Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "ViaRecordInfoBranch", "fromRec" + tm, null); | |
| 959 | + Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "z9hG4bK-ViaRecordInfo-" + tm, "fromRec" + tm, null); | |
| 962 | 960 | |
| 963 | 961 | transmitRequest(device, request); |
| 964 | 962 | } catch (SipException | ParseException | InvalidArgumentException e) { |
| ... | ... | @@ -1101,7 +1099,7 @@ public class SIPCommander implements ISIPCommander { |
| 1101 | 1099 | mobilePostitionXml.append("</Query>\r\n"); |
| 1102 | 1100 | |
| 1103 | 1101 | String tm = Long.toString(System.currentTimeMillis()); |
| 1104 | - Request request = headerProvider.createMessageRequest(device, mobilePostitionXml.toString(), "viaTagPos" + tm, "fromTagPos" + tm, null); | |
| 1102 | + Request request = headerProvider.createMessageRequest(device, mobilePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null); | |
| 1105 | 1103 | |
| 1106 | 1104 | transmitRequest(device, request, errorEvent); |
| 1107 | 1105 | |
| ... | ... | @@ -1134,7 +1132,7 @@ public class SIPCommander implements ISIPCommander { |
| 1134 | 1132 | subscribePostitionXml.append("</Query>\r\n"); |
| 1135 | 1133 | |
| 1136 | 1134 | String tm = Long.toString(System.currentTimeMillis()); |
| 1137 | - Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "viaTagPos" + tm, "fromTagPos" + tm, null, expires, "presence" ); //Position;id=" + tm.substring(tm.length() - 4)); | |
| 1135 | + Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ); //Position;id=" + tm.substring(tm.length() - 4)); | |
| 1138 | 1136 | transmitRequest(device, request); |
| 1139 | 1137 | |
| 1140 | 1138 | return true; |
| ... | ... | @@ -1187,7 +1185,7 @@ public class SIPCommander implements ISIPCommander { |
| 1187 | 1185 | cmdXml.append("</Query>\r\n"); |
| 1188 | 1186 | |
| 1189 | 1187 | String tm = Long.toString(System.currentTimeMillis()); |
| 1190 | - Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "viaTagPos" + tm, "fromTagPos" + tm, null, expires, "presence" ); | |
| 1188 | + Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ); | |
| 1191 | 1189 | transmitRequest(device, request); |
| 1192 | 1190 | |
| 1193 | 1191 | return true; | ... | ... |