From 279ae44a25328e519a9f55d363661350dc870099 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Fri, 15 Mar 2024 16:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wvp/service/gb28181/Gb28181DownloadService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 ff76ae2..3a2b28f 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 @@ -222,7 +222,7 @@ public class Gb28181DownloadService { }); } - download(deviceCode, startTime, endTime, useDownload).whenCompleteAsync((videoInfo, e) -> { + download(deviceCode, startTime, endTime, useDownload).whenComplete((videoInfo, e) -> { writeFileHeader(response, deviceCode, startTime, endTime, fileHeader); log.info("videoInfo {}", videoInfo); if (e != null) { @@ -241,7 +241,7 @@ public class Gb28181DownloadService { } else { videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND) + 15); } - }, executor); + }); } catch(Exception e) { writeErrorToResponse(asyncResponse, JsonResponse.error(e.getMessage())); } finally { @@ -371,7 +371,7 @@ public class Gb28181DownloadService { DateTime start = DateUtil.date(); HttpServletResponse asyncResponse = (HttpServletResponse)asyncContext.getResponse(); try{ - download(deviceCode, startTime,endTime).whenCompleteAsync((videoInfo, e)->{ + download(deviceCode, startTime,endTime).whenComplete((videoInfo, e)->{ streamHeader(asyncResponse); if(e != null){ writeErrorToResponse(asyncResponse, JsonResponse.error(e.getMessage())); @@ -389,7 +389,7 @@ public class Gb28181DownloadService { } else { videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND) + 15); } - }, executor); + }); } catch(Exception e) { writeErrorToResponse(asyncResponse, JsonResponse.error(e.getMessage())); @@ -593,7 +593,7 @@ public class Gb28181DownloadService { subscribe.getInviteSubscribe().addSubscribe(subscribeKey, subscriber); RedisUtil.StringOps.set(cacheKey, callId.getCallId()); // 用以 提前 启动 ffmpeg 预备录制, 需要配置 ffmpeg rw_timeout 时长 避免收不到流 - result.completeAsync(() -> new VideoInfo(streamId, videoRtmpUrl(streamId), callId.getCallId(), device), executor); + result.complete(new VideoInfo(streamId, videoRtmpUrl(streamId), callId.getCallId(), device)); return SipRequestBuilder.createInviteRequest(ip, port, docking, device.getGbDeviceChannelId(), description.toString(), SipUtil.generateViaTag(), SipUtil.generateFromTag(), null, ssrc, callId); }; }