取消使用 zlmStreamProxy
This commit is contained in:
parent
c930d2d79d
commit
8c581b7eea
@ -13,5 +13,4 @@ public class ZlmHookConfig {
|
|||||||
private String hook;
|
private String hook;
|
||||||
private Duration delay = Duration.ofMillis(100);
|
private Duration delay = Duration.ofMillis(100);
|
||||||
private Duration fixed = Duration.ofSeconds(30);
|
private Duration fixed = Duration.ofSeconds(30);
|
||||||
private Boolean proxy = true;
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import cn.skcks.docking.gb28181.core.sip.gb28181.sdp.GB28181Description;
|
|||||||
import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe;
|
import cn.skcks.docking.gb28181.core.sip.message.subscribe.GenericSubscribe;
|
||||||
import cn.skcks.docking.gb28181.core.sip.utils.SipUtil;
|
import cn.skcks.docking.gb28181.core.sip.utils.SipUtil;
|
||||||
import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
|
import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
|
||||||
import cn.skcks.docking.gb28181.media.dto.proxy.AddStreamProxy;
|
|
||||||
import cn.skcks.docking.gb28181.media.dto.rtp.StartSendRtp;
|
import cn.skcks.docking.gb28181.media.dto.rtp.StartSendRtp;
|
||||||
import cn.skcks.docking.gb28181.media.dto.rtp.StartSendRtpResp;
|
import cn.skcks.docking.gb28181.media.dto.rtp.StartSendRtpResp;
|
||||||
import cn.skcks.docking.gb28181.media.proxy.ZlmMediaService;
|
import cn.skcks.docking.gb28181.media.proxy.ZlmMediaService;
|
||||||
@ -108,23 +107,12 @@ public class DeviceProxyService {
|
|||||||
zlmStreamChangeHookService.getUnregistHandler().put(callId,()->{
|
zlmStreamChangeHookService.getUnregistHandler().put(callId,()->{
|
||||||
sendBye(request,device,key);
|
sendBye(request,device,key);
|
||||||
});
|
});
|
||||||
if(zlmHookConfig.getProxy()){
|
|
||||||
AddStreamProxy addStreamProxy = AddStreamProxy.builder()
|
|
||||||
.app("live")
|
|
||||||
.stream(callId)
|
|
||||||
.url(fromUrl)
|
|
||||||
.timeoutSec(30.0)
|
|
||||||
.build();
|
|
||||||
zlmMediaService.addStreamProxy(addStreamProxy);
|
|
||||||
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
|
||||||
} else {
|
|
||||||
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
||||||
String zlmRtpUrl = "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/live/" + callId;
|
String zlmRtpUrl = "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/live/" + callId;
|
||||||
Executor executor = pushRtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
Executor executor = pushRtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
||||||
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
||||||
callbackTask.put(device.getDeviceCode(), executor);
|
callbackTask.put(device.getDeviceCode(), executor);
|
||||||
executeResultHandler.waitFor();
|
executeResultHandler.waitFor();
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -159,23 +147,12 @@ public class DeviceProxyService {
|
|||||||
zlmStreamChangeHookService.getUnregistHandler().put(callId,()->{
|
zlmStreamChangeHookService.getUnregistHandler().put(callId,()->{
|
||||||
sendBye(request,device,key);
|
sendBye(request,device,key);
|
||||||
});
|
});
|
||||||
if(zlmHookConfig.getProxy()){
|
|
||||||
AddStreamProxy addStreamProxy = AddStreamProxy.builder()
|
|
||||||
.app("live")
|
|
||||||
.stream(callId)
|
|
||||||
.url(fromUrl)
|
|
||||||
.timeoutSec(30.0)
|
|
||||||
.build();
|
|
||||||
zlmMediaService.addStreamProxy(addStreamProxy);
|
|
||||||
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
|
||||||
} else {
|
|
||||||
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
||||||
String zlmRtpUrl = "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/live/" + callId;
|
String zlmRtpUrl = "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/live/" + callId;
|
||||||
Executor executor = pushDownload2RtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
Executor executor = pushDownload2RtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
||||||
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS);
|
||||||
downloadTask.put(device.getDeviceCode(), executor);
|
downloadTask.put(device.getDeviceCode(), executor);
|
||||||
executeResultHandler.waitFor();
|
executeResultHandler.waitFor();
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user