修复语音对讲接口空指针异常
parent
2492b0d638
commit
cbd6a57e15
|
@ -211,11 +211,12 @@ public class PlayController {
|
|||
if (device == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
|
||||
}
|
||||
if (channelId == null) {
|
||||
DeviceChannel channel = deviceChannelService.getOneForSource(device.getId(), channelId);
|
||||
if (channel == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到通道: " + channelId);
|
||||
}
|
||||
|
||||
return playService.audioBroadcast(device, channelId, broadcastMode);
|
||||
return playService.audioBroadcast(device, channel, broadcastMode);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public interface IPlayService {
|
|||
|
||||
void zlmServerOnline(String mediaServerId);
|
||||
|
||||
AudioBroadcastResult audioBroadcast(Device device, String channelId, Boolean broadcastMode);
|
||||
AudioBroadcastResult audioBroadcast(Device device, DeviceChannel deviceChannel, Boolean broadcastMode);
|
||||
|
||||
boolean audioBroadcastCmd(Device device, DeviceChannel channel, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
|
|
|
@ -1197,23 +1197,18 @@ public class PlayServiceImpl implements IPlayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AudioBroadcastResult audioBroadcast(Device device, String channelId, Boolean broadcastMode) {
|
||||
public AudioBroadcastResult audioBroadcast(Device device, DeviceChannel deviceChannel, Boolean broadcastMode) {
|
||||
// TODO 必须多端口模式才支持语音喊话鹤语音对讲
|
||||
if (device == null || channelId == null) {
|
||||
return null;
|
||||
}
|
||||
log.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), channelId);
|
||||
DeviceChannel deviceChannel = deviceChannelService.getOne(device.getDeviceId(), channelId);
|
||||
if (deviceChannel == null) {
|
||||
log.warn("开启语音广播的时候未找到通道: {}", channelId);
|
||||
if (device == null || deviceChannel == null) {
|
||||
return null;
|
||||
}
|
||||
log.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), deviceChannel.getDeviceId());
|
||||
MediaServer mediaServerItem = mediaServerService.getMediaServerForMinimumLoad(null);
|
||||
if (broadcastMode == null) {
|
||||
broadcastMode = true;
|
||||
}
|
||||
String app = broadcastMode?"broadcast":"talk";
|
||||
String stream = device.getDeviceId() + "_" + channelId;
|
||||
String stream = device.getDeviceId() + "_" + deviceChannel.getDeviceId();
|
||||
AudioBroadcastResult audioBroadcastResult = new AudioBroadcastResult();
|
||||
audioBroadcastResult.setApp(app);
|
||||
audioBroadcastResult.setStream(stream);
|
||||
|
|
|
@ -795,7 +795,12 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
|
||||
streamInfoResult.setIp(addr);
|
||||
streamInfoResult.setServerId(mediaInfo.getServerId());
|
||||
if (mediaInfo != null) {
|
||||
streamInfoResult.setServerId(mediaInfo.getServerId());
|
||||
}else {
|
||||
streamInfoResult.setServerId(userSetting.getServerId());
|
||||
}
|
||||
|
||||
streamInfoResult.setMediaServer(mediaServer);
|
||||
String callIdParam = ObjectUtils.isEmpty(callId)?"":"?callId=" + callId;
|
||||
streamInfoResult.setRtmp(addr, mediaServer.getRtmpPort(),mediaServer.getRtmpSSlPort(), app, stream, callIdParam);
|
||||
|
|
Loading…
Reference in New Issue