实时流重复请求则关闭上一次请求的实时流

This commit is contained in:
shikong 2024-01-30 10:22:43 +08:00
parent 512617bdb2
commit d799f10420

View File

@ -404,6 +404,10 @@ public class DeviceProxyService {
@SneakyThrows
public void pullLiveStream2Rtp(SIPRequest request,Runnable sendOkResponse,String callId, MockingDevice device, String rtpAddr, int rtpPort, String ssrc){
String liveCache = CacheUtil.getKey("INVITE", "LIVE", device.getGbDeviceId());
// 关闭已存在的实时流 bye 订阅如果存在
subscribe.getByeSubscribe().delPublisher(liveCache);
ScheduledFuture<?> schedule = trying(request);
Retryer<ZlmResponse<AddStreamProxyResp>> retryer = RetryerBuilder.<ZlmResponse<AddStreamProxyResp>>newBuilder()
.retryIfResult(resp -> {
@ -474,6 +478,8 @@ public class DeviceProxyService {
});
Flow.Subscriber<SIPRequest> subscriber = zlmByeSubscriber(key,request,device);
liveCache = CacheUtil.getKey("INVITE", "LIVE", device.getGbDeviceId());
RedisUtil.StringOps.set(liveCache, key);
subscribe.getByeSubscribe().addPublisher(key);
subscribe.getByeSubscribe().addSubscribe(key, subscriber);
} catch (Exception e) {