|
|
@@ -3,12 +3,15 @@ package com.genersoft.iot.vmp.service.impl;
|
|
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
|
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
|
|
+import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
|
|
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
|
|
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
|
|
import com.genersoft.iot.vmp.gb28181.task.impl.CatalogSubscribeTask;
|
|
|
import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeTask;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler;
|
|
|
+import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
|
|
+import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
|
|
import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
|
|
import com.genersoft.iot.vmp.service.IDeviceService;
|
|
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
|
|
@@ -32,9 +35,7 @@ import javax.sip.InvalidArgumentException;
|
|
|
import javax.sip.SipException;
|
|
|
import java.text.ParseException;
|
|
|
import java.time.Instant;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
@@ -89,6 +90,12 @@ public class DeviceServiceImpl implements IDeviceService {
|
|
|
@Autowired
|
|
|
private IMediaServerService mediaServerService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AudioBroadcastManager audioBroadcastManager;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZLMRESTfulUtils zlmresTfulUtils;
|
|
|
+
|
|
|
@Override
|
|
|
public void online(Device device) {
|
|
|
logger.info("[设备上线] deviceId:{}->{}:{}", device.getDeviceId(), device.getIp(), device.getPort());
|
|
|
@@ -183,6 +190,23 @@ public class DeviceServiceImpl implements IDeviceService {
|
|
|
// 移除订阅
|
|
|
removeCatalogSubscribe(device);
|
|
|
removeMobilePositionSubscribe(device);
|
|
|
+ List<AudioBroadcastCatch> audioBroadcastCatches = audioBroadcastManager.get(deviceId);
|
|
|
+ if (audioBroadcastCatches.size() > 0) {
|
|
|
+ for (AudioBroadcastCatch audioBroadcastCatch : audioBroadcastCatches) {
|
|
|
+ SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(deviceId, audioBroadcastCatch.getChannelId(), null, null);
|
|
|
+ if (sendRtpItem != null) {
|
|
|
+ redisCatchStorage.deleteSendRTPServer(deviceId, sendRtpItem.getChannelId(), null, null);
|
|
|
+ MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("vhost", "__defaultVhost__");
|
|
|
+ param.put("app", sendRtpItem.getApp());
|
|
|
+ param.put("stream", sendRtpItem.getStreamId());
|
|
|
+ zlmresTfulUtils.stopSendRtp(mediaInfo, param);
|
|
|
+ }
|
|
|
+
|
|
|
+ audioBroadcastManager.del(deviceId, audioBroadcastCatch.getChannelId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|