Merge branch 'refs/heads/2.7.0'
# Conflicts: # src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java # src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java # src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java # src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java # src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java # src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java # src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java # src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisStreamMsgListener.java # src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java # src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
This commit is contained in:
@@ -45,6 +45,8 @@ public interface IRedisCatchStorage {
|
||||
|
||||
void updateSendRTPSever(SendRtpItem sendRtpItem);
|
||||
|
||||
List<SendRtpItem> querySendRTPServer(String platformGbId, String channelId, String streamId);
|
||||
|
||||
/**
|
||||
* 查询RTP推送信息缓存
|
||||
* @param platformGbId
|
||||
@@ -197,6 +199,8 @@ public interface IRedisCatchStorage {
|
||||
|
||||
void addDiskInfo(List<Map<String, Object>> diskInfo);
|
||||
|
||||
void deleteSendRTPServer(SendRtpItem sendRtpItem);
|
||||
|
||||
List<SendRtpItem> queryAllSendRTPServer();
|
||||
|
||||
List<Device> getAllDevices();
|
||||
@@ -209,7 +213,7 @@ public interface IRedisCatchStorage {
|
||||
|
||||
void sendPlatformStartPlayMsg(MessageForPushChannel messageForPushChannel);
|
||||
|
||||
void sendPlatformStopPlayMsg(MessageForPushChannel messageForPushChannel);
|
||||
void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform);
|
||||
|
||||
void addPushListItem(String app, String stream, MediaArrivalEvent param);
|
||||
|
||||
@@ -219,4 +223,11 @@ public interface IRedisCatchStorage {
|
||||
|
||||
void sendPushStreamClose(MessageForPushChannel messageForPushChannel);
|
||||
|
||||
void addWaiteSendRtpItem(SendRtpItem sendRtpItem, int platformPlayTimeout);
|
||||
|
||||
SendRtpItem getWaiteSendRtpItem(String app, String stream);
|
||||
|
||||
void sendStartSendRtp(SendRtpItem sendRtpItem);
|
||||
|
||||
void sendPushStreamOnline(SendRtpItem sendRtpItem);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ public interface DeviceChannelMapper {
|
||||
"<if test='status != null'>, status=#{status}</if>" +
|
||||
"<if test='streamId != null'>, stream_id=#{streamId}</if>" +
|
||||
"<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
|
||||
", custom_longitude=#{longitude}" +
|
||||
", custom_latitude=#{latitude}" +
|
||||
"<if test='customLongitude != null'>, custom_longitude=#{customLongitude}</if>" +
|
||||
"<if test='customLatitude != null'>, custom_latitude=#{customLatitude}</if>" +
|
||||
"<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
|
||||
"<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
|
||||
"<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
|
||||
@@ -89,8 +89,10 @@ public interface DeviceChannelMapper {
|
||||
"dc.password, " +
|
||||
"COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " +
|
||||
"dc.status, " +
|
||||
"COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " +
|
||||
"COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " +
|
||||
"dc.longitude, " +
|
||||
"dc.latitude, " +
|
||||
"dc.custom_longitude, " +
|
||||
"dc.custom_latitude, " +
|
||||
"dc.stream_id, " +
|
||||
"dc.device_id, " +
|
||||
"dc.parental, " +
|
||||
@@ -345,6 +347,8 @@ public interface DeviceChannelMapper {
|
||||
"<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" +
|
||||
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
|
||||
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
|
||||
"<if test='item.customLongitude != null'>, custom_longitude=#{item.customLongitude}</if>" +
|
||||
"<if test='item.customLatitude != null'>, custom_latitude=#{item.customLatitude}</if>" +
|
||||
"<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
|
||||
"<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
|
||||
"<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
|
||||
@@ -397,6 +401,23 @@ public interface DeviceChannelMapper {
|
||||
" </script>"})
|
||||
int updatePosition(DeviceChannel deviceChannel);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='deviceChannelList' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET gps_time=#{item.gpsTime}" +
|
||||
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
|
||||
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
|
||||
"<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
|
||||
"<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
|
||||
"<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
|
||||
"<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
|
||||
"WHERE device_id=#{item.deviceId} " +
|
||||
" <if test='item.channelId != null' > AND channel_id=#{item.channelId}</if>" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdatePosition(List<DeviceChannel> deviceChannelList);
|
||||
|
||||
@Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0")
|
||||
List<DeviceChannel> getAllChannelInPlay();
|
||||
|
||||
|
||||
@@ -33,4 +33,33 @@ public interface DeviceMobilePositionMapper {
|
||||
@Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
|
||||
int clearMobilePositionsByDeviceId(String deviceId);
|
||||
|
||||
|
||||
@Insert("<script> " +
|
||||
"insert into wvp_device_mobile_position " +
|
||||
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
|
||||
"longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+
|
||||
"values " +
|
||||
"<foreach collection='mobilePositions' index='index' item='item' separator=','> " +
|
||||
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
||||
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
||||
"#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.longitudeWgs84}, #{item.latitudeWgs84}, " +
|
||||
"#{item.createTime}) " +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void batchadd2(List<MobilePosition> mobilePositions);
|
||||
|
||||
@Insert("<script> " +
|
||||
"<foreach collection='mobilePositions' index='index' item='item' separator=','> " +
|
||||
"insert into wvp_device_mobile_position " +
|
||||
"(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," +
|
||||
"longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+
|
||||
"values " +
|
||||
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
|
||||
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
|
||||
"#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.longitudeWgs84}, #{item.latitudeWgs84}, " +
|
||||
"#{item.createTime}); " +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void batchadd(List<MobilePosition> mobilePositions);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
@@ -146,15 +148,26 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
@Override
|
||||
public void updateSendRTPSever(SendRtpItem sendRtpItem) {
|
||||
redisTemplate.opsForValue().set(sendRtpItem.getRedisKey(), sendRtpItem);
|
||||
}
|
||||
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX +
|
||||
userSetting.getServerId() + "_"
|
||||
+ sendRtpItem.getMediaServerId() + "_"
|
||||
+ sendRtpItem.getPlatformId() + "_"
|
||||
+ sendRtpItem.getChannelId() + "_"
|
||||
+ sendRtpItem.getStream() + "_"
|
||||
+ sendRtpItem.getCallId();
|
||||
redisTemplate.opsForValue().set(key, sendRtpItem);
|
||||
@Override
|
||||
public List<SendRtpItem> querySendRTPServer(String platformGbId, String channelId, String streamId) {
|
||||
String scanKey = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
||||
+ userSetting.getServerId() + "_*_"
|
||||
+ platformGbId + "_"
|
||||
+ channelId + "_"
|
||||
+ streamId + "_"
|
||||
+ "*";
|
||||
List<SendRtpItem> result = new ArrayList<>();
|
||||
List<Object> scan = RedisUtil.scan(redisTemplate, scanKey);
|
||||
if (!scan.isEmpty()) {
|
||||
for (Object o : scan) {
|
||||
String key = (String) o;
|
||||
result.add(JsonUtil.redisJsonToObject(redisTemplate, key, SendRtpItem.class));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -172,7 +185,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
callId = "*";
|
||||
}
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
||||
+ userSetting.getServerId() + "_*_"
|
||||
+ "*_*_"
|
||||
+ platformGbId + "_"
|
||||
+ channelId + "_"
|
||||
+ streamId + "_"
|
||||
@@ -268,11 +281,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
List<Object> scan = RedisUtil.scan(redisTemplate, key);
|
||||
if (scan.size() > 0) {
|
||||
for (Object keyStr : scan) {
|
||||
logger.info("[删除 redis的SendRTP]: {}", keyStr.toString());
|
||||
redisTemplate.delete(keyStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除RTP推送信息缓存
|
||||
*/
|
||||
@Override
|
||||
public void deleteSendRTPServer(SendRtpItem sendRtpItem) {
|
||||
deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),sendRtpItem.getCallId(), sendRtpItem.getStream());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SendRtpItem> queryAllSendRTPServer() {
|
||||
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
|
||||
@@ -555,7 +577,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void sendMobilePositionMsg(JSONObject jsonObject) {
|
||||
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION;
|
||||
logger.info("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString());
|
||||
// logger.info("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString());
|
||||
redisTemplate.convertAndSend(key, jsonObject);
|
||||
}
|
||||
|
||||
@@ -646,9 +668,15 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPlatformStopPlayMsg(MessageForPushChannel msg) {
|
||||
public void sendPlatformStopPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform) {
|
||||
|
||||
MessageForPushChannel msg = MessageForPushChannel.getInstance(0,
|
||||
sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(),
|
||||
sendRtpItem.getPlatformId(), platform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId());
|
||||
msg.setPlatFormIndex(platform.getId());
|
||||
|
||||
String key = VideoManagerConstants.VM_MSG_STREAM_STOP_PLAY_NOTIFY;
|
||||
logger.info("[redis发送通知] 发送 上级平台停止观看 {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
|
||||
logger.info("[redis发送通知] 发送 上级平台停止观看 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());
|
||||
redisTemplate.convertAndSend(key, JSON.toJSON(msg));
|
||||
}
|
||||
|
||||
@@ -681,4 +709,30 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
logger.info("[redis发送通知] 发送 停止向上级推流 {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
|
||||
redisTemplate.convertAndSend(key, JSON.toJSON(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWaiteSendRtpItem(SendRtpItem sendRtpItem, int platformPlayTimeout) {
|
||||
String key = VideoManagerConstants.WAITE_SEND_PUSH_STREAM + sendRtpItem.getApp() + "_" + sendRtpItem.getStream();
|
||||
redisTemplate.opsForValue().set(key, sendRtpItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendRtpItem getWaiteSendRtpItem(String app, String stream) {
|
||||
String key = VideoManagerConstants.WAITE_SEND_PUSH_STREAM + app + "_" + stream;
|
||||
return JsonUtil.redisJsonToObject(redisTemplate, key, SendRtpItem.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendStartSendRtp(SendRtpItem sendRtpItem) {
|
||||
String key = VideoManagerConstants.START_SEND_PUSH_STREAM + sendRtpItem.getApp() + "_" + sendRtpItem.getStream();
|
||||
logger.info("[redis发送通知] 通知其他WVP推流 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getPlatformId());
|
||||
redisTemplate.convertAndSend(key, JSON.toJSON(sendRtpItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPushStreamOnline(SendRtpItem sendRtpItem) {
|
||||
String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_CLOSE_REQUESTED;
|
||||
logger.info("[redis发送通知] 流上线 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getPlatformId());
|
||||
redisTemplate.convertAndSend(key, JSON.toJSON(sendRtpItem));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user