From e83e8809915973f4e7756d60ea4b508685b6df67 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 14 Jun 2024 16:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=AD=E9=9F=B3=E5=AF=B9?= =?UTF-8?q?=E8=AE=B2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/impl/PlayServiceImpl.java | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 6b3a0f4b..ee2abd49 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -1113,33 +1113,28 @@ public class PlayServiceImpl implements IPlayService { } @Override - public boolean audioBroadcastCmd(Device device, String channelId, MediaServerItem mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException { - if (device == null || channelId == null) { - return false; - } - logger.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), channelId); - DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId); - if (deviceChannel == null) { - logger.warn("开启语音广播的时候未找到通道: {}", channelId); - event.call(-1, "开启语音广播的时候未找到通道"); + public boolean audioBroadcastCmd(Device device, DeviceChannel deviceChannel, MediaServerItem mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException { + if (device == null || deviceChannel == null) { + event.call(-1, "参数不全"); return false; } + logger.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), deviceChannel.getChannelId()); // 查询通道使用状态 - if (audioBroadcastManager.exit(device.getDeviceId(), channelId)) { - SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); - if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { - // 查询流是否存在,不存在则认为是异常状态 - Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); - if (streamReady) { - logger.warn("语音广播已经开启: {}", channelId); - event.call(-1,"语音广播已经开启"); - return false; - } else { - stopAudioBroadcast(device.getDeviceId(), channelId); - } - } - } - +// if (audioBroadcastManager.exit(device.getDeviceId(), deviceChannel.getChannelId())) { +// SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); +// if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { +// // 查询流是否存在,不存在则认为是异常状态 +// Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); +// if (streamReady) { +// logger.warn("语音广播已经开启: {}", channelId); +// event.call(-1,"语音广播已经开启"); +// return false; +// } else { +// stopAudioBroadcast(device.getDeviceId(), channelId); +// } +// } +// } + String channelId = deviceChannel.getChannelId(); // 发送通知 cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> { // 发送成功