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

View File

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