调整 getProxyUrl
This commit is contained in:
parent
ff6a5484e3
commit
8f0b0be8b3
@ -63,6 +63,7 @@ import javax.sip.address.SipURI;
|
|||||||
import javax.sip.header.CallIdHeader;
|
import javax.sip.header.CallIdHeader;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
|
import java.io.File;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@ -582,9 +583,15 @@ public class DeviceProxyService {
|
|||||||
CompletableFuture<JsonResponse<String>> task = videoCacheManager.get(device.getDeviceCode(), startTime, endTime);
|
CompletableFuture<JsonResponse<String>> task = videoCacheManager.get(device.getDeviceCode(), startTime, endTime);
|
||||||
if(task != null){
|
if(task != null){
|
||||||
if(task.isDone()){
|
if(task.isDone()){
|
||||||
String file = task.get().getData();
|
String filePath = task.get().getData();
|
||||||
log.info("本地视频已缓存, 将从本地缓存推流, 缓存文件 => {}", file);
|
File file = new File(filePath);
|
||||||
return file;
|
if(StringUtils.isNotBlank(filePath) && file.exists()){
|
||||||
|
log.info("本地视频已缓存, 将从本地缓存推流, 缓存文件 => {}", filePath);
|
||||||
|
return filePath;
|
||||||
|
} else {
|
||||||
|
log.info("缓存已失效, 将直接使用 http代理 推流 并 重新缓存, 缓存文件 => {}", filePath);
|
||||||
|
videoCacheManager.addTask(device.getDeviceCode(), startTime, endTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user