DeviceProxyService 调整
This commit is contained in:
parent
d64bba2c9c
commit
723ad67df9
@ -250,9 +250,15 @@ public class DeviceProxyService {
|
|||||||
|
|
||||||
public TaskProcessor downloadTask(){
|
public TaskProcessor downloadTask(){
|
||||||
return (Runnable sendOkResponse,SIPRequest request,String callId,String fromUrl, String toAddr,int toPort, MockingDevice device, String key, long time,String ssrc)->{
|
return (Runnable sendOkResponse,SIPRequest request,String callId,String fromUrl, String toAddr,int toPort, MockingDevice device, String key, long time,String ssrc)->{
|
||||||
|
try {
|
||||||
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("{}", e.getMessage());
|
||||||
|
}
|
||||||
String ackKey = GenericSubscribe.Helper.getKey(Request.ACK, callId);
|
String ackKey = GenericSubscribe.Helper.getKey(Request.ACK, callId);
|
||||||
subscribe.getAckSubscribe().addPublisher(ackKey, 1, TimeUnit.MINUTES);
|
subscribe.getAckSubscribe().addPublisher(ackKey, 1, TimeUnit.MINUTES);
|
||||||
subscribe.getAckSubscribe().addSubscribe(ackKey, new Flow.Subscriber<>() {
|
subscribe.getAckSubscribe().addSubscribe(ackKey, new Flow.Subscriber<>() {
|
||||||
|
private SIPRequest ackRequest;
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Flow.Subscription subscription) {
|
public void onSubscribe(Flow.Subscription subscription) {
|
||||||
subscription.request(1);
|
subscription.request(1);
|
||||||
@ -260,6 +266,7 @@ public class DeviceProxyService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(SIPRequest item) {
|
public void onNext(SIPRequest item) {
|
||||||
|
ackRequest = item;
|
||||||
subscribe.getAckSubscribe().delPublisher(ackKey);
|
subscribe.getAckSubscribe().delPublisher(ackKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,6 +278,7 @@ public class DeviceProxyService {
|
|||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Flow.Subscriber<SIPRequest> task = ffmpegTask(request, downloadTask, callId, key, device);
|
Flow.Subscriber<SIPRequest> task = ffmpegTask(request, downloadTask, callId, key, device);
|
||||||
try {
|
try {
|
||||||
|
if(ackRequest != null){
|
||||||
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(request, device, key);
|
||||||
if (!ffmpegConfig.getRtp().getUseRtpToDownload()) {
|
if (!ffmpegConfig.getRtp().getUseRtpToDownload()) {
|
||||||
String zlmRtpUrl = getZlmRtmpUrl(DEFAULT_ZLM_APP, callId);
|
String zlmRtpUrl = getZlmRtmpUrl(DEFAULT_ZLM_APP, callId);
|
||||||
@ -292,6 +300,7 @@ public class DeviceProxyService {
|
|||||||
downloadTask.put(device.getDeviceCode(), executor);
|
downloadTask.put(device.getDeviceCode(), executor);
|
||||||
}
|
}
|
||||||
executeResultHandler.waitFor();
|
executeResultHandler.waitFor();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
sendBye(request, device, "");
|
sendBye(request, device, "");
|
||||||
log.error("{}", e.getMessage());
|
log.error("{}", e.getMessage());
|
||||||
|
Loading…
Reference in New Issue
Block a user