This commit is contained in:
shikong 2023-12-14 17:14:52 +08:00
parent 2bb56f5bbc
commit 7528fdbb4b

View File

@ -41,6 +41,7 @@ import gov.nist.javax.sdp.fields.TimeField;
import gov.nist.javax.sdp.fields.URIField;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse;
import jakarta.annotation.PreDestroy;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -254,6 +255,8 @@ public class Gb28181DownloadService {
String url = StringUtils.isNotBlank(proxySipConfig.getProxyMediaUrl()) ?
StringUtils.replace(videoInfo.getUrl(), zlmMediaConfig.getUrl(), proxySipConfig.getProxyMediaUrl()):
videoInfo.getUrl();
realtimeVideo.put(deviceCode, url);
result.setResult(JsonResponse.success(url));
});
}, 200, TimeUnit.MILLISECONDS);
@ -299,6 +302,7 @@ public class Gb28181DownloadService {
public void closeRealtimeVideoNow(WvpProxyDocking docking, WvpProxyDevice device, Gb28181DownloadService.VideoInfo videoInfo, String cacheKey, String existCallId){
log.info("结束实时视频 发送 bye 关闭 {} {}", videoInfo.getDevice().getGbDeviceChannelId(), videoInfo.getCallId());
realtimeVideo.remove(device.getDeviceCode());
String deviceIp = docking.getIp();
int devicePort = Integer.parseInt(docking.getPort());
if (StringUtils.isNotBlank(existCallId)) {
@ -628,4 +632,11 @@ public class Gb28181DownloadService {
}
return subscriber;
}
@PreDestroy
private void destroy(){
realtimeVideo.forEach((key,item)->{
closeRealtimeVideoNow(key);
});
}
}