提前到 发起 invite 请求时 启动 ffmpeg 预备录制
This commit is contained in:
parent
0feb5ad242
commit
c456d2e1ea
@ -563,6 +563,8 @@ public class Gb28181DownloadService {
|
|||||||
Flow.Subscriber<SIPResponse> subscriber = inviteSubscriber(docking,device,subscribeKey,cacheKey, ssrc, streamId, result, time + 60, TimeUnit.SECONDS);
|
Flow.Subscriber<SIPResponse> subscriber = inviteSubscriber(docking,device,subscribeKey,cacheKey, ssrc, streamId, result, time + 60, TimeUnit.SECONDS);
|
||||||
subscribe.getInviteSubscribe().addSubscribe(subscribeKey, subscriber);
|
subscribe.getInviteSubscribe().addSubscribe(subscribeKey, subscriber);
|
||||||
RedisUtil.StringOps.set(cacheKey, callId.getCallId());
|
RedisUtil.StringOps.set(cacheKey, callId.getCallId());
|
||||||
|
// 用以 提前 启动 ffmpeg 预备录制
|
||||||
|
result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId.getCallId(), device), executor);
|
||||||
return SipRequestBuilder.createInviteRequest(ip, port, docking, device.getGbDeviceChannelId(), description.toString(), SipUtil.generateViaTag(), SipUtil.generateFromTag(), null, ssrc, callId);
|
return SipRequestBuilder.createInviteRequest(ip, port, docking, device.getGbDeviceChannelId(), description.toString(), SipUtil.generateViaTag(), SipUtil.generateFromTag(), null, ssrc, callId);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -571,8 +573,6 @@ public class Gb28181DownloadService {
|
|||||||
ScheduledFuture<?>[] schedule = new ScheduledFuture<?>[1];
|
ScheduledFuture<?>[] schedule = new ScheduledFuture<?>[1];
|
||||||
Flow.Subscriber<SIPResponse> subscriber = new Flow.Subscriber<>() {
|
Flow.Subscriber<SIPResponse> subscriber = new Flow.Subscriber<>() {
|
||||||
private Flow.Subscription subscription;
|
private Flow.Subscription subscription;
|
||||||
private boolean isStart = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Flow.Subscription subscription) {
|
public void onSubscribe(Flow.Subscription subscription) {
|
||||||
this.subscription = subscription;
|
this.subscription = subscription;
|
||||||
@ -587,19 +587,10 @@ public class Gb28181DownloadService {
|
|||||||
if (statusCode == Response.TRYING) {
|
if (statusCode == Response.TRYING) {
|
||||||
log.info("订阅 {} {} 尝试连接流媒体服务", MessageProcessor.Method.INVITE, subscribeKey);
|
log.info("订阅 {} {} 尝试连接流媒体服务", MessageProcessor.Method.INVITE, subscribeKey);
|
||||||
subscription.request(1);
|
subscription.request(1);
|
||||||
String callId = item.getCallId().getCallId();
|
|
||||||
if(!isStart){
|
|
||||||
isStart = true;
|
|
||||||
result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId, device), executor);
|
|
||||||
}
|
|
||||||
} 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);
|
||||||
String callId = item.getCallId().getCallId();
|
String callId = item.getCallId().getCallId();
|
||||||
if(!isStart){
|
|
||||||
isStart = true;
|
|
||||||
result.completeAsync(() -> new VideoInfo(streamId,videoUrl(streamId), callId, device), executor);
|
|
||||||
}
|
|
||||||
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();
|
||||||
|
Loading…
Reference in New Issue
Block a user