|
@@ -86,7 +86,6 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
|
|
|
private final SSRCInfo info;
|
|
private final SSRCInfo info;
|
|
|
private HookSubscribe.Subscription owner;
|
|
private HookSubscribe.Subscription owner;
|
|
|
private final java.util.concurrent.atomic.AtomicBoolean terminal = new java.util.concurrent.atomic.AtomicBoolean();
|
|
private final java.util.concurrent.atomic.AtomicBoolean terminal = new java.util.concurrent.atomic.AtomicBoolean();
|
|
|
- private final java.util.concurrent.atomic.AtomicBoolean released = new java.util.concurrent.atomic.AtomicBoolean();
|
|
|
|
|
private ManagedRtp(SSRCInfo info) { this.info = info; }
|
|
private ManagedRtp(SSRCInfo info) { this.info = info; }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -219,7 +218,13 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
|
|
|
0, false, param.isDisableAudio(), false, param.getTcpMode());
|
|
0, false, param.isDisableAudio(), false, param.getTcpMode());
|
|
|
entry.info.setPort(port);
|
|
entry.info.setPort(port);
|
|
|
// Only the creator knows create returned. Restart during create remains CREATING.
|
|
// Only the creator knows create returned. Restart during create remains CREATING.
|
|
|
- if (!allocationState(node, entry.info, RtpState.CREATING, RtpState.OPEN)) return null;
|
|
|
|
|
|
|
+ if (!allocationState(node, entry.info, RtpState.CREATING, RtpState.OPEN)) {
|
|
|
|
|
+ // The port was already created above. A failed receipt transition must not leak it:
|
|
|
|
|
+ // close the exact allocation instead of returning silently.
|
|
|
|
|
+ closeManagedRTPServer(node, entry.info);
|
|
|
|
|
+ callback.run(InviteErrorCode.FAIL.getCode(), "Managed RTP receipt not acknowledged", null);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
if (port <= 0 || cancelled(stream) || entry.terminal.get()) {
|
|
if (port <= 0 || cancelled(stream) || entry.terminal.get()) {
|
|
|
closeManagedRTPServer(node, entry.info);
|
|
closeManagedRTPServer(node, entry.info);
|
|
|
callback.run(InviteErrorCode.FAIL.getCode(), "Managed RTP allocation failed or was cancelled", null);
|
|
callback.run(InviteErrorCode.FAIL.getCode(), "Managed RTP allocation failed or was cancelled", null);
|
|
@@ -324,7 +329,6 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
|
|
|
private final SSRCInfo info;
|
|
private final SSRCInfo info;
|
|
|
private HookSubscribe.Subscription owner;
|
|
private HookSubscribe.Subscription owner;
|
|
|
private final java.util.concurrent.atomic.AtomicBoolean terminal = new java.util.concurrent.atomic.AtomicBoolean();
|
|
private final java.util.concurrent.atomic.AtomicBoolean terminal = new java.util.concurrent.atomic.AtomicBoolean();
|
|
|
- private final java.util.concurrent.atomic.AtomicBoolean released = new java.util.concurrent.atomic.AtomicBoolean();
|
|
|
|
|
private LegacyRtp(SSRCInfo info) { this.info = info; }
|
|
private LegacyRtp(SSRCInfo info) { this.info = info; }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -419,7 +423,12 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
|
|
|
rtpServerPort = rtpServerParam.getMediaServerItem().getRtpProxyPort();
|
|
rtpServerPort = rtpServerParam.getMediaServerItem().getRtpProxyPort();
|
|
|
}
|
|
}
|
|
|
ssrcInfo.setPort(rtpServerPort);
|
|
ssrcInfo.setPort(rtpServerPort);
|
|
|
- if (!allocationState(rtpServerParam.getMediaServerItem(), ssrcInfo, RtpState.CREATING, RtpState.OPEN)) return null;
|
|
|
|
|
|
|
+ if (!allocationState(rtpServerParam.getMediaServerItem(), ssrcInfo, RtpState.CREATING, RtpState.OPEN)) {
|
|
|
|
|
+ // A created port must be closed even when the receipt transition did not commit.
|
|
|
|
|
+ closeAllocation(rtpServerParam.getMediaServerItem(), ssrcInfo);
|
|
|
|
|
+ callback.run(InviteErrorCode.FAIL.getCode(), "RTP receipt not acknowledged", null);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
if (rtpServerPort == 0) {
|
|
if (rtpServerPort == 0) {
|
|
|
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "开启RTPServer失败", null);
|
|
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "开启RTPServer失败", null);
|
|
|
// 释放ssrc
|
|
// 释放ssrc
|