优化ssrc释放逻辑

pull/1217/head
648540858 2023-12-15 16:44:46 +08:00
parent 04a1bfa329
commit 2397344973
1 changed files with 10 additions and 7 deletions

View File

@ -40,6 +40,7 @@ import javax.sip.SipFactory;
import javax.sip.header.CallIdHeader; import javax.sip.header.CallIdHeader;
import javax.sip.message.Request; import javax.sip.message.Request;
import java.text.ParseException; import java.text.ParseException;
import java.util.List;
/** /**
* @description: * @description:
@ -612,11 +613,12 @@ public class SIPCommander implements ISIPCommander {
*/ */
@Override @Override
public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException { public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, callId, stream); List<SsrcTransaction> ssrcTransactionList = streamSession.getSsrcTransactionForAll(device.getDeviceId(), channelId, callId, stream);
if (ssrcTransaction == null) { if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) {
throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream); throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream);
} }
for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc()); mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream()); mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
@ -625,6 +627,7 @@ public class SIPCommander implements ISIPCommander {
Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo()); Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent); sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
} }
}
/** /**
* 广 * 广