临时提交

This commit is contained in:
648540858
2024-09-07 00:04:36 +08:00
parent d472ed4485
commit b7e96de36a
18 changed files with 354 additions and 294 deletions

View File

@@ -89,9 +89,7 @@ public interface IDeviceChannelService {
void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition);
void startPlay(String deviceId, String channelId, String stream);
void stopPlay(String deviceId, String channelId);
void startPlay(Integer channelId, String stream);
void stopPlay(Integer channelId);

View File

@@ -25,27 +25,27 @@ public interface IPlayService {
ErrorCallback<StreamInfo> callback);
SSRCInfo play(MediaServer mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<StreamInfo> callback);
StreamInfo onPublishHandlerForPlay(MediaServer mediaServerItem, MediaInfo mediaInfo, String deviceId, String channelId);
StreamInfo onPublishHandlerForPlay(MediaServer mediaServerItem, MediaInfo mediaInfo, Device device, DeviceChannel channel);
MediaServer getNewMediaServerItem(Device device);
void playBack(String deviceId, String channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
void playBack(Device device, DeviceChannel channel, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
void zlmServerOffline(String mediaServerId);
void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
void download(MediaServer mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
void download(Device device, DeviceChannel channel, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
void download(MediaServer mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channel, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream);
StreamInfo getDownLoadInfo(Device deviceId, DeviceChannel channelId, String stream);
void zlmServerOnline(String mediaServerId);
AudioBroadcastResult audioBroadcast(Device device, String channelId, Boolean broadcastMode);
boolean audioBroadcastCmd(Device device, String channelId, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
boolean audioBroadcastCmd(Device device, DeviceChannel channelId, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
boolean audioBroadcastInUse(Device device, String channelId);
boolean audioBroadcastInUse(Device device, DeviceChannel channelId);
void stopAudioBroadcast(String deviceId, String channelId);
void stopAudioBroadcast(Device deviceId, DeviceChannel channelId);
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
@@ -55,13 +55,13 @@ public interface IPlayService {
void startSendRtpStreamFailHand(SendRtpInfo sendRtpItem, Platform platform, CallIdHeader callIdHeader);
void talkCmd(Device device, String channelId, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);
void talkCmd(Device device, DeviceChannel channel, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);
void stopTalk(Device device, String channelId, Boolean streamIsReady);
void stopTalk(Device device, DeviceChannel channel, Boolean streamIsReady);
void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback);
void stopPlay(Device device, String channelId);
void stopPlay(Device device, DeviceChannel channel);
void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback);

View File

@@ -362,21 +362,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public void startPlay(String deviceId, String channelId, String stream) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备: " +deviceId);
}
channelMapper.startPlay(device.getId(), channelId, stream);
}
@Override
public void stopPlay(String deviceId, String channelId) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备: " +deviceId);
}
channelMapper.stopPlay(device.getId(), channelId);
public void startPlay(Integer channelId, String stream) {
channelMapper.startPlay(channelId, stream);
}
@Override

View File

@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
@@ -98,7 +99,7 @@ public class PlatformServiceImpl implements IPlatformService {
private PlatformChannelMapper platformChannelMapper;
@Autowired
private EventPublisher eventPublisher;
private IGbChannelService channelService;
/**
* 流离开的处理
@@ -112,10 +113,11 @@ public class PlatformServiceImpl implements IPlatformService {
if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) {
String platformId = sendRtpItem.getPlatformId();
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
CommonGBChannel channel = channelService.getOne(sendRtpItem.getChannelId());
try {
if (platform != null) {
commanderForPlatform.streamByeCmd(platform, sendRtpItem);
redisCatchStorage.deleteSendRTPServer(platformId, sendRtpItem.getChannelId(),
if (platform != null && channel != null) {
commanderForPlatform.streamByeCmd(platform, sendRtpItem, channel);
redisCatchStorage.deleteSendRTPServer(platformId, channel.getGbDeviceId(),
sendRtpItem.getCallId(), sendRtpItem.getStream());
}
} catch (SipException | InvalidArgumentException | ParseException e) {
@@ -137,9 +139,10 @@ public class PlatformServiceImpl implements IPlatformService {
if (sendRtpItems != null && !sendRtpItems.isEmpty()) {
for (SendRtpInfo sendRtpItem : sendRtpItems) {
Platform platform = platformMapper.getParentPlatByServerGBId(sendRtpItem.getPlatformId());
CommonGBChannel channel = channelService.getOne(sendRtpItem.getChannelId());
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
try {
commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
commanderForPlatform.streamByeCmd(platform, sendRtpItem, channel);
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
}