Commit 70c20364af15fce16992fce499efc623823ce221
1 parent
1abfced3
修复流注销时移除流认证信息
Showing
2 changed files
with
60 additions
and
10 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipTransactionInfo.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | |
| 2 | + | |
| 3 | +import gov.nist.javax.sip.message.SIPRequest; | |
| 4 | + | |
| 5 | +public class SipTransactionInfo { | |
| 6 | + | |
| 7 | + private String callId; | |
| 8 | + private String fromTag; | |
| 9 | + private String toTag; | |
| 10 | + private String viaBranch; | |
| 11 | + | |
| 12 | + public SipTransactionInfo(SIPRequest request) { | |
| 13 | + this.callId = request.getCallIdHeader().getCallId(); | |
| 14 | + this.fromTag = request.getFromTag(); | |
| 15 | + this.toTag = request.getToTag(); | |
| 16 | + this.viaBranch = request.getTopmostViaHeader().getBranch(); | |
| 17 | + } | |
| 18 | + | |
| 19 | + public SipTransactionInfo() { | |
| 20 | + } | |
| 21 | + | |
| 22 | + public String getCallId() { | |
| 23 | + return callId; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void setCallId(String callId) { | |
| 27 | + this.callId = callId; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public String getFromTag() { | |
| 31 | + return fromTag; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setFromTag(String fromTag) { | |
| 35 | + this.fromTag = fromTag; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getToTag() { | |
| 39 | + return toTag; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setToTag(String toTag) { | |
| 43 | + this.toTag = toTag; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getViaBranch() { | |
| 47 | + return viaBranch; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setViaBranch(String viaBranch) { | |
| 51 | + this.viaBranch = viaBranch; | |
| 52 | + } | |
| 53 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -417,10 +417,11 @@ public class ZLMHttpHookListener { |
| 417 | 417 | String schema = item.getSchema(); |
| 418 | 418 | List<MediaItem.MediaTrack> tracks = item.getTracks(); |
| 419 | 419 | boolean regist = item.isRegist(); |
| 420 | - if (item.getOriginType() == OriginType.RTMP_PUSH.ordinal() | |
| 421 | - || item.getOriginType() == OriginType.RTSP_PUSH.ordinal() | |
| 422 | - || item.getOriginType() == OriginType.RTC_PUSH.ordinal()) { | |
| 423 | - if (regist) { | |
| 420 | + if (regist) { | |
| 421 | + if (item.getOriginType() == OriginType.RTMP_PUSH.ordinal() | |
| 422 | + || item.getOriginType() == OriginType.RTSP_PUSH.ordinal() | |
| 423 | + || item.getOriginType() == OriginType.RTC_PUSH.ordinal()) { | |
| 424 | + | |
| 424 | 425 | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream); |
| 425 | 426 | if (streamAuthorityInfo == null) { |
| 426 | 427 | streamAuthorityInfo = StreamAuthorityInfo.getInstanceByHook(item); |
| ... | ... | @@ -429,9 +430,9 @@ public class ZLMHttpHookListener { |
| 429 | 430 | streamAuthorityInfo.setOriginTypeStr(item.getOriginTypeStr()); |
| 430 | 431 | } |
| 431 | 432 | redisCatchStorage.updateStreamAuthorityInfo(app, stream, streamAuthorityInfo); |
| 432 | - }else { | |
| 433 | - redisCatchStorage.removeStreamAuthorityInfo(app, stream); | |
| 434 | 433 | } |
| 434 | + }else { | |
| 435 | + redisCatchStorage.removeStreamAuthorityInfo(app, stream); | |
| 435 | 436 | } |
| 436 | 437 | |
| 437 | 438 | if ("rtsp".equals(schema)){ |
| ... | ... | @@ -451,16 +452,12 @@ public class ZLMHttpHookListener { |
| 451 | 452 | if (streamInfo!=null){ |
| 452 | 453 | redisCatchStorage.stopPlay(streamInfo); |
| 453 | 454 | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); |
| 454 | - // 如果正在给上级推送,则发送bye | |
| 455 | - | |
| 456 | - | |
| 457 | 455 | }else{ |
| 458 | 456 | streamInfo = redisCatchStorage.queryPlayback(null, null, stream, null); |
| 459 | 457 | if (streamInfo != null) { |
| 460 | 458 | redisCatchStorage.stopPlayback(streamInfo.getDeviceID(), streamInfo.getChannelId(), |
| 461 | 459 | streamInfo.getStream(), null); |
| 462 | 460 | } |
| 463 | - // 如果正在给上级推送,则发送bye | |
| 464 | 461 | } |
| 465 | 462 | }else { |
| 466 | 463 | if (!"rtp".equals(app)){ | ... | ... |