调整 ffmpeg 启动时机
This commit is contained in:
parent
fdc826e246
commit
2dc1f43401
@ -592,14 +592,17 @@ public class Gb28181DownloadService {
|
|||||||
public void onNext(SIPResponse item) {
|
public void onNext(SIPResponse item) {
|
||||||
int statusCode = item.getStatusCode();
|
int statusCode = item.getStatusCode();
|
||||||
log.debug("{} 收到订阅消息 {}", subscribeKey, item);
|
log.debug("{} 收到订阅消息 {}", subscribeKey, item);
|
||||||
if (statusCode == Response.TRYING) {
|
if(statusCode == Response.OK){
|
||||||
log.info("订阅 {} {} 尝试连接流媒体服务", MessageProcessor.Method.INVITE, subscribeKey);
|
|
||||||
subscription.request(1);
|
|
||||||
String callId = item.getCallId().getCallId();
|
String callId = item.getCallId().getCallId();
|
||||||
if(!isStart){
|
if(!isStart){
|
||||||
isStart = true;
|
isStart = true;
|
||||||
result.completeAsync(() -> new VideoInfo(streamId,videoRtmpUrl(streamId), callId, device), executor);
|
result.completeAsync(() -> new VideoInfo(streamId,videoRtmpUrl(streamId), callId, device), executor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusCode == Response.TRYING) {
|
||||||
|
log.info("订阅 {} {} 尝试连接流媒体服务", MessageProcessor.Method.INVITE, subscribeKey);
|
||||||
|
subscription.request(1);
|
||||||
} else if (statusCode >= Response.OK && statusCode < Response.MULTIPLE_CHOICES) {
|
} else if (statusCode >= Response.OK && statusCode < Response.MULTIPLE_CHOICES) {
|
||||||
log.info("订阅 {} {} 流媒体服务连接成功, 开始推送视频流", MessageProcessor.Method.INVITE, subscribeKey);
|
log.info("订阅 {} {} 流媒体服务连接成功, 开始推送视频流", MessageProcessor.Method.INVITE, subscribeKey);
|
||||||
log.info("收到响应状态 {}", statusCode);
|
log.info("收到响应状态 {}", statusCode);
|
||||||
@ -608,6 +611,7 @@ public class Gb28181DownloadService {
|
|||||||
isStart = true;
|
isStart = true;
|
||||||
result.completeAsync(() -> new VideoInfo(streamId,videoRtmpUrl(streamId), callId, device), executor);
|
result.completeAsync(() -> new VideoInfo(streamId,videoRtmpUrl(streamId), callId, device), executor);
|
||||||
}
|
}
|
||||||
|
scheduledExecutorService.schedule(()->{
|
||||||
sender.sendRequest(((provider, ip, port) -> {
|
sender.sendRequest(((provider, ip, port) -> {
|
||||||
String fromTag = item.getFromTag();
|
String fromTag = item.getFromTag();
|
||||||
String toTag = item.getToTag();
|
String toTag = item.getToTag();
|
||||||
@ -616,6 +620,7 @@ public class Gb28181DownloadService {
|
|||||||
subscribe.getByeSubscribe().addSubscribe(key, byeSubscriber(key, device, cacheKey, streamId, time, unit));
|
subscribe.getByeSubscribe().addSubscribe(key, byeSubscriber(key, device, cacheKey, streamId, time, unit));
|
||||||
return SipRequestBuilder.createAckRequest(Response.OK, ip, port, docking, device.getGbDeviceChannelId(), fromTag, toTag, callId);
|
return SipRequestBuilder.createAckRequest(Response.OK, ip, port, docking, device.getGbDeviceChannelId(), fromTag, toTag, callId);
|
||||||
}));
|
}));
|
||||||
|
},100, TimeUnit.MILLISECONDS);
|
||||||
} else {
|
} else {
|
||||||
log.info("订阅 {} {} 连接流媒体服务时出现异常, 终止订阅", MessageProcessor.Method.INVITE, subscribeKey);
|
log.info("订阅 {} {} 连接流媒体服务时出现异常, 终止订阅", MessageProcessor.Method.INVITE, subscribeKey);
|
||||||
zlmMediaService.closeRtpServer(new CloseRtpServer(streamId));
|
zlmMediaService.closeRtpServer(new CloseRtpServer(streamId));
|
||||||
|
Loading…
Reference in New Issue
Block a user