From c456d2e1ea03f82ff31588468347b7e3b40e4b34 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Mon, 26 Feb 2024 09:48:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=89=8D=E5=88=B0=20=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=20invite=20=E8=AF=B7=E6=B1=82=E6=97=B6=20=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=20ffmpeg=20=E9=A2=84=E5=A4=87=E5=BD=95=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wvp/service/gb28181/Gb28181DownloadService.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java index 8ebad69..849b6dd 100644 --- a/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java +++ b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java @@ -563,6 +563,8 @@ public class Gb28181DownloadService { Flow.Subscriber subscriber = inviteSubscriber(docking,device,subscribeKey,cacheKey, ssrc, streamId, result, time + 60, TimeUnit.SECONDS); subscribe.getInviteSubscribe().addSubscribe(subscribeKey, subscriber); RedisUtil.StringOps.set(cacheKey, callId.getCallId()); + // 用以 提前 启动 ffmpeg 预备录制 + result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId.getCallId(), device), executor); return SipRequestBuilder.createInviteRequest(ip, port, docking, device.getGbDeviceChannelId(), description.toString(), SipUtil.generateViaTag(), SipUtil.generateFromTag(), null, ssrc, callId); }; } @@ -571,8 +573,6 @@ public class Gb28181DownloadService { ScheduledFuture[] schedule = new ScheduledFuture[1]; Flow.Subscriber subscriber = new Flow.Subscriber<>() { private Flow.Subscription subscription; - private boolean isStart = false; - @Override public void onSubscribe(Flow.Subscription subscription) { this.subscription = subscription; @@ -587,19 +587,10 @@ public class Gb28181DownloadService { if (statusCode == Response.TRYING) { log.info("订阅 {} {} 尝试连接流媒体服务", MessageProcessor.Method.INVITE, subscribeKey); subscription.request(1); - String callId = item.getCallId().getCallId(); - if(!isStart){ - isStart = true; - result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId, device), executor); - } } else if (statusCode >= Response.OK && statusCode < Response.MULTIPLE_CHOICES) { log.info("订阅 {} {} 流媒体服务连接成功, 开始推送视频流", MessageProcessor.Method.INVITE, subscribeKey); log.info("收到响应状态 {}", statusCode); String callId = item.getCallId().getCallId(); - if(!isStart){ - isStart = true; - result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId, device), executor); - } sender.sendRequest(((provider, ip, port) -> { String fromTag = item.getFromTag(); String toTag = item.getToTag();