playback 订阅器修正

This commit is contained in:
shikong 2023-10-05 17:38:46 +08:00
parent cc9f7a0e73
commit 72c11e4625
2 changed files with 4 additions and 12 deletions

View File

@ -24,16 +24,11 @@ public class SipSubscribe {
@Qualifier(DefaultSipExecutor.EXECUTOR_BEAN_NAME) @Qualifier(DefaultSipExecutor.EXECUTOR_BEAN_NAME)
private final Executor executor; private final Executor executor;
private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
private GenericSubscribe<RecordInfoResponseDTO> recordInfoSubscribe;
private GenericSubscribe<SIPResponse> inviteSubscribe;
private GenericTimeoutSubscribe<SIPResponse> sipResponseSubscribe; private GenericTimeoutSubscribe<SIPResponse> sipResponseSubscribe;
private GenericTimeoutSubscribe<SIPRequest> sipRequestSubscribe; private GenericTimeoutSubscribe<SIPRequest> sipRequestSubscribe;
@PostConstruct @PostConstruct
private void init() { private void init() {
// TODO 准备废弃
recordInfoSubscribe = new RecordInfoSubscribe(executor);
inviteSubscribe = new InviteSubscribe(executor);
// 通用订阅器 // 通用订阅器
sipResponseSubscribe = new SipResponseSubscribe(executor, scheduledExecutorService); sipResponseSubscribe = new SipResponseSubscribe(executor, scheduledExecutorService);
sipRequestSubscribe = new SipRequestSubscribe(executor, scheduledExecutorService); sipRequestSubscribe = new SipRequestSubscribe(executor, scheduledExecutorService);
@ -41,9 +36,6 @@ public class SipSubscribe {
@PreDestroy @PreDestroy
private void destroy() { private void destroy() {
inviteSubscribe.close();
recordInfoSubscribe.close();
sipResponseSubscribe.close(); sipResponseSubscribe.close();
sipRequestSubscribe.close(); sipRequestSubscribe.close();
} }

View File

@ -310,7 +310,7 @@ public class PlayService {
@Override @Override
public void onComplete() { public void onComplete() {
subscribe.getRecordInfoSubscribe().delPublisher(subscribeKey); subscribe.getSipResponseSubscribe().delPublisher(subscribeKey);
} }
}; };
byeSubscribe(inviteRequestBuilder,provider,callId,DateUtil.between(startTime,endTime,DateUnit.SECOND),()->{ byeSubscribe(inviteRequestBuilder,provider,callId,DateUtil.between(startTime,endTime,DateUnit.SECOND),()->{
@ -339,9 +339,9 @@ public class PlayService {
@Override @Override
@SneakyThrows @SneakyThrows
public void onNext(SIPRequest item) { public void onNext(SIPRequest item) {
subscribe.getRecordInfoSubscribe().delPublisher(GenericSubscribe.Helper.getKey(Request.INVITE, callId)); sipRequestSubscribe.delPublisher(GenericSubscribe.Helper.getKey(Request.INVITE, callId));
request = item; request = item;
subscribe.getRecordInfoSubscribe().complete(subscribeKey); sipRequestSubscribe.complete(subscribeKey);
} }
@Override @Override
@ -360,7 +360,7 @@ public class PlayService {
provider.sendRequest(byeRequest); provider.sendRequest(byeRequest);
} }
cb.run(); cb.run();
subscribe.getRecordInfoSubscribe().delPublisher(subscribeKey); sipRequestSubscribe.delPublisher(subscribeKey);
} }
}; };
sipRequestSubscribe.addSubscribe(subscribeKey,subscriber); sipRequestSubscribe.addSubscribe(subscribeKey,subscriber);