Commit 239734497335770dee832072bc23b97d9231e0fb

Authored by 648540858
1 parent 04a1bfa3

优化ssrc释放逻辑

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -40,6 +40,7 @@ import javax.sip.SipFactory; @@ -40,6 +40,7 @@ import javax.sip.SipFactory;
40 import javax.sip.header.CallIdHeader; 40 import javax.sip.header.CallIdHeader;
41 import javax.sip.message.Request; 41 import javax.sip.message.Request;
42 import java.text.ParseException; 42 import java.text.ParseException;
  43 +import java.util.List;
43 44
44 /** 45 /**
45 * @description:设备能力接口,用于定义设备的控制、查询能力 46 * @description:设备能力接口,用于定义设备的控制、查询能力
@@ -612,18 +613,20 @@ public class SIPCommander implements ISIPCommander { @@ -612,18 +613,20 @@ public class SIPCommander implements ISIPCommander {
612 */ 613 */
613 @Override 614 @Override
614 public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException { 615 public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
615 - SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, callId, stream);  
616 - if (ssrcTransaction == null) { 616 + List<SsrcTransaction> ssrcTransactionList = streamSession.getSsrcTransactionForAll(device.getDeviceId(), channelId, callId, stream);
  617 + if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) {
617 throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream); 618 throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream);
618 } 619 }
619 620
620 - mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc()); 621 + for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
  622 + mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
621 623
622 - mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());  
623 - streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId()); 624 + mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
  625 + streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
624 626
625 - Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());  
626 - sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent); 627 + Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
  628 + sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
  629 + }
627 } 630 }
628 631
629 /** 632 /**