[集群] 增加语音对讲支持

This commit is contained in:
648540858
2025-01-21 17:35:21 +08:00
parent 135f3054e6
commit ba27819874
8 changed files with 117 additions and 15 deletions

View File

@@ -208,16 +208,8 @@ public class PlayController {
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
if (channel == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到通道: " + channelId);
}
return playService.audioBroadcast(device, channel, broadcastMode);
return playService.audioBroadcast(deviceId, channelId, broadcastMode);
}

View File

@@ -40,7 +40,7 @@ public interface IPlayService {
void zlmServerOnline(MediaServer mediaServer);
AudioBroadcastResult audioBroadcast(Device device, DeviceChannel deviceChannel, Boolean broadcastMode);
AudioBroadcastResult audioBroadcast(String deviceId, String channelDeviceId, Boolean broadcastMode);
boolean audioBroadcastCmd(Device device, DeviceChannel channel, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;

View File

@@ -1236,10 +1236,19 @@ public class PlayServiceImpl implements IPlayService {
}
@Override
public AudioBroadcastResult audioBroadcast(Device device, DeviceChannel deviceChannel, Boolean broadcastMode) {
// TODO 必须多端口模式才支持语音喊话鹤语音对讲
if (device == null || deviceChannel == null) {
return null;
public AudioBroadcastResult audioBroadcast(String deviceId, String channelDeviceId, Boolean broadcastMode) {
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}
DeviceChannel deviceChannel = deviceChannelService.getOne(deviceId, channelDeviceId);
if (deviceChannel == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到通道: " + channelDeviceId);
}
if (!userSetting.getServerId().equals(device.getDeviceId())) {
return redisRpcPlayService.audioBroadcast(device.getServerId(), deviceId, channelDeviceId, broadcastMode);
}
log.info("[语音喊话] device {}, channel: {}", device.getDeviceId(), deviceChannel.getDeviceId());
MediaServer mediaServerItem = mediaServerService.getMediaServerForMinimumLoad(null);