Commit 9de1bef82147389a524f2096d99d9a7aa5440538
Committed by
GitHub
Merge pull request #34 from lawrencehj/wvp-28181-2.0
解决非默认端口无法Send Bye的问题
Showing
3 changed files
with
14 additions
and
10 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -409,12 +409,7 @@ public class SIPCommander implements ISIPCommander { |
| 409 | 409 | try { |
| 410 | 410 | MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 411 | 411 | String ssrc = streamSession.createPlayBackSsrc(); |
| 412 | - String streamId = null; | |
| 413 | - if (rtpEnable) { | |
| 414 | - streamId = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId); | |
| 415 | - }else { | |
| 416 | - streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); | |
| 417 | - } | |
| 412 | + String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); | |
| 418 | 413 | // 添加订阅 |
| 419 | 414 | JSONObject subscribeKey = new JSONObject(); |
| 420 | 415 | subscribeKey.put("app", "rtp"); |
| ... | ... | @@ -531,7 +526,10 @@ public class SIPCommander implements ISIPCommander { |
| 531 | 526 | Pattern p = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+)\\:(\\d+)"); |
| 532 | 527 | Matcher matcher = p.matcher(vh); |
| 533 | 528 | if (matcher.find()) { |
| 534 | - byeURI.setHost(matcher.group(1)); | |
| 529 | + String ip = matcher.group(1); | |
| 530 | + byeURI.setHost(ip); | |
| 531 | + String port = matcher.group(2); | |
| 532 | + byeURI.setPort(Integer.parseInt(port)); | |
| 535 | 533 | } |
| 536 | 534 | ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME); |
| 537 | 535 | String protocol = viaHeader.getTransport().toUpperCase(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
| ... | ... | @@ -342,7 +342,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 342 | 342 | try { |
| 343 | 343 | // 回复200 OK |
| 344 | 344 | responseAck(evt); |
| 345 | - String seqNo = String.valueOf(System.currentTimeMillis()); | |
| 345 | + String uuid = UUID.randomUUID().toString().replace("-", ""); | |
| 346 | 346 | RecordInfo recordInfo = new RecordInfo(); |
| 347 | 347 | Element rootElement = getRootElement(evt); |
| 348 | 348 | Element deviceIdElement = rootElement.element("DeviceID"); |
| ... | ... | @@ -398,7 +398,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 398 | 398 | // 为防止连续请求该设备的录像数据,返回数据错乱,特增加sn进行区分 |
| 399 | 399 | String cacheKey = CACHE_RECORDINFO_KEY + deviceId + sn; |
| 400 | 400 | |
| 401 | - redis.set(cacheKey + "_" + seqNo, recordList, 90); | |
| 401 | + redis.set(cacheKey + "_" + uuid, recordList, 90); | |
| 402 | 402 | List<Object> cacheKeys = redis.scan(cacheKey + "_*"); |
| 403 | 403 | List<RecordItem> totalRecordList = new ArrayList<RecordItem>(); |
| 404 | 404 | for (int i = 0; i < cacheKeys.size(); i++) { | ... | ... |
web_src/src/components/gb28181/devicePlayer.vue
| ... | ... | @@ -183,7 +183,8 @@ export default { |
| 183 | 183 | scanGroup: 0, |
| 184 | 184 | tracks: [], |
| 185 | 185 | coverPlaying:false, |
| 186 | - tracksLoading: false | |
| 186 | + tracksLoading: false, | |
| 187 | + recordPlay: "" | |
| 187 | 188 | }; |
| 188 | 189 | }, |
| 189 | 190 | methods: { |
| ... | ... | @@ -318,6 +319,10 @@ export default { |
| 318 | 319 | this.convertStop(); |
| 319 | 320 | } |
| 320 | 321 | this.convertKey = '' |
| 322 | + if (this.recordPlay != '') { | |
| 323 | + this.stopPlayRecord(); | |
| 324 | + } | |
| 325 | + this.recordPlay = '' | |
| 321 | 326 | }, |
| 322 | 327 | |
| 323 | 328 | copySharedInfo: function (data) { |
| ... | ... | @@ -384,6 +389,7 @@ export default { |
| 384 | 389 | var streamInfo = res.data; |
| 385 | 390 | that.streamId = streamInfo.streamId; |
| 386 | 391 | that.videoUrl = streamInfo.ws_flv; |
| 392 | + that.recordPlay = true; | |
| 387 | 393 | }); |
| 388 | 394 | } |
| 389 | 395 | }, | ... | ... |