mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 14:07:50 +08:00
1078-双向对讲完成
This commit is contained in:
parent
87ecf68332
commit
de6a3ceb76
@ -800,7 +800,7 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "对讲进行中");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "对讲进行中");
|
||||||
}
|
}
|
||||||
|
|
||||||
String reciveStream = deviceId + "_" + channelId;
|
String receiveStream = "1078" + "_" + deviceId + "_" + channelId;
|
||||||
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||||
if (mediaServer == null) {
|
if (mediaServer == null) {
|
||||||
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
for (GeneralCallback<StreamInfo> errorCallback : errorCallbacks) {
|
||||||
@ -828,11 +828,11 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
sendRtpItem.setTcpActive(true);
|
sendRtpItem.setTcpActive(true);
|
||||||
sendRtpItem.setUsePs(false);
|
sendRtpItem.setUsePs(false);
|
||||||
sendRtpItem.setOnlyAudio(true);
|
sendRtpItem.setOnlyAudio(true);
|
||||||
sendRtpItem.setReceiveStream(reciveStream);
|
sendRtpItem.setReceiveStream(receiveStream);
|
||||||
sendRtpItem.setPlatformId(deviceId);
|
sendRtpItem.setPlatformId(deviceId);
|
||||||
|
|
||||||
// 设置hook监听
|
// 设置hook监听
|
||||||
Hook hook = Hook.getInstance(HookType.on_media_arrival, "rtp", reciveStream, mediaServer.getId());
|
Hook hook = Hook.getInstance(HookType.on_media_arrival, "rtp", receiveStream, mediaServer.getId());
|
||||||
subscribe.addSubscribe(hook, (hookData) -> {
|
subscribe.addSubscribe(hook, (hookData) -> {
|
||||||
dynamicTask.stop(playKey);
|
dynamicTask.stop(playKey);
|
||||||
logger.info("[1078-对讲] 对讲成功, deviceId: {}, channelId: {}", deviceId, channelId);
|
logger.info("[1078-对讲] 对讲成功, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||||
@ -846,6 +846,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
// 存储发流信息
|
// 存储发流信息
|
||||||
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
||||||
});
|
});
|
||||||
|
Hook hookForDeparture = Hook.getInstance(HookType.on_media_departure, "rtp", receiveStream, mediaServer.getId());
|
||||||
|
subscribe.addSubscribe(hookForDeparture, (hookData) -> {
|
||||||
|
logger.info("[1078-对讲] 对讲时源流注销, app: {}. stream: {}, deviceId: {}, channelId: {}",app, stream, deviceId, channelId);
|
||||||
|
stopTalk(deviceId, channelId);
|
||||||
|
});
|
||||||
|
|
||||||
// 设置超时监听
|
// 设置超时监听
|
||||||
dynamicTask.startDelay(playKey, () -> {
|
dynamicTask.startDelay(playKey, () -> {
|
||||||
logger.info("[1078-对讲] 超时, deviceId: {}, channelId: {}", deviceId, channelId);
|
logger.info("[1078-对讲] 超时, deviceId: {}, channelId: {}", deviceId, channelId);
|
||||||
|
|||||||
@ -268,8 +268,11 @@ public class MediaServiceImpl implements IMediaService {
|
|||||||
storager.stopPlay(inviteInfo.getDeviceId(), inviteInfo.getChannelId());
|
storager.stopPlay(inviteInfo.getDeviceId(), inviteInfo.getChannelId());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (stream.startsWith("1078")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, stream, null);
|
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, stream, null);
|
||||||
if (sendRtpItem != null && "talk".equals(sendRtpItem.getApp())) {
|
if (sendRtpItem != null && "talk".equals(sendRtpItem.getApp() )) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ("talk".equals(app) || "broadcast".equals(app)) {
|
} else if ("talk".equals(app) || "broadcast".equals(app)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user