From 054ab252053be4e6016dda7d106e82aef4bcc11a Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Fri, 15 Mar 2024 10:48:03 +0800 Subject: [PATCH] =?UTF-8?q?downloadToStream=20=E6=B7=BB=E5=8A=A0=20-t=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20/video=20ffmpegRecord=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/Gb28181DownloadService.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 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 f003f41..eecaab0 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 @@ -232,6 +232,10 @@ public class Gb28181DownloadService { } else if (wvpProxyConfig.getUseFfmpeg()) { executor.execute(()-> { videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND), videoInfo.getDevice(), videoInfo.getCallId()); + + DateTime end = DateUtil.date(); + asyncContext.complete(); + log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); }); } else { videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime, endTime, DateUnit.SECOND) + 15); @@ -240,9 +244,11 @@ public class Gb28181DownloadService { } catch(Exception e) { writeErrorToResponse(asyncResponse, JsonResponse.error(e.getMessage())); } finally { - DateTime end = DateUtil.date(); - asyncContext.complete(); - log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); + if(!wvpProxyConfig.getUseFfmpeg()){ + DateTime end = DateUtil.date(); + asyncContext.complete(); + log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); + } } }); } @@ -373,6 +379,10 @@ public class Gb28181DownloadService { } else if(wvpProxyConfig.getUseFfmpeg()){ executor.execute(()->{ videoService.ffmpegRecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND),videoInfo.getDevice(),videoInfo.getCallId()); + + DateTime end = DateUtil.date(); + asyncContext.complete(); + log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); }); } else { videoService.javaCVrecord(asyncResponse, videoInfo.getUrl(), DateUtil.between(startTime,endTime,DateUnit.SECOND) + 15); @@ -382,9 +392,11 @@ public class Gb28181DownloadService { writeErrorToResponse(asyncResponse, JsonResponse.error(e.getMessage())); } finally { - DateTime end = DateUtil.date(); - asyncContext.complete(); - log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); + if(!wvpProxyConfig.getUseFfmpeg()){ + DateTime end = DateUtil.date(); + asyncContext.complete(); + log.info("下载总耗时: {}, deviceCode {}, startTime {}, endTime {}", DateUtil.between(start,end, DateUnit.SECOND), deviceCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime)); + } } }); }