支持多WVP的推流播放
This commit is contained in:
@@ -414,4 +414,46 @@ public interface CommonGBChannelMapper {
|
||||
" </script>"})
|
||||
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
|
||||
List<CommonGBChannel> channelList);
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='commonGBChannels' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", gb_device_id=#{item.gbDeviceId}" +
|
||||
", gb_name=#{item.gbName}" +
|
||||
", gb_manufacturer=#{item.gbManufacturer}" +
|
||||
", gb_model=#{item.gbModel}" +
|
||||
", gb_owner=#{item.gbOwner}" +
|
||||
", gb_civil_code=#{item.gbCivilCode}" +
|
||||
", gb_block=#{item.gbBlock}" +
|
||||
", gb_address=#{item.gbAddress}" +
|
||||
", gb_parental=#{item.gbParental}" +
|
||||
", gb_safety_way=#{item.gbSafetyWay}" +
|
||||
", gb_register_way=#{item.gbRegisterWay}" +
|
||||
", gb_cert_num=#{item.gbCertNum}" +
|
||||
", gb_certifiable=#{item.gbCertifiable}" +
|
||||
", gb_err_code=#{item.gbErrCode}" +
|
||||
", gb_end_time=#{item.gbEndTime}" +
|
||||
", gb_ip_address=#{item.gbIpAddress}" +
|
||||
", gb_port=#{item.gbPort}" +
|
||||
", gb_password=#{item.gbPassword}" +
|
||||
", gb_status=#{item.gbStatus}" +
|
||||
", gb_longitude=#{item.gbLongitude}" +
|
||||
", gb_latitude=#{item.gbLatitude}" +
|
||||
", gb_ptz_type=#{item.gbPtzType}" +
|
||||
", gb_position_type=#{item.gbPositionType}" +
|
||||
", gb_room_type=#{item.gbRoomType}" +
|
||||
", gb_use_type=#{item.gbUseType}" +
|
||||
", gb_supply_light_type=#{item.gbSupplyLightType}" +
|
||||
", gb_direction_type=#{item.gbDirectionType}" +
|
||||
", gb_resolution=#{item.gbResolution}" +
|
||||
", gb_business_group_id=#{item.gbBusinessGroupId}" +
|
||||
", gb_download_speed=#{item.gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}" +
|
||||
" WHERE id=#{item.id}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdate(List<CommonGBChannel> commonGBChannels);
|
||||
}
|
||||
|
||||
@@ -73,4 +73,6 @@ public interface IGbChannelService {
|
||||
void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds);
|
||||
|
||||
void deleteChannelToGroupByGbDevice(List<Integer> deviceIds);
|
||||
|
||||
void batchUpdate(List<CommonGBChannel> commonGBChannels);
|
||||
}
|
||||
|
||||
@@ -238,6 +238,36 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[新增多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdate(List<CommonGBChannel> commonGBChannels) {
|
||||
if (commonGBChannels.isEmpty()) {
|
||||
log.warn("[更新多个通道] 通道数量为0,更新失败");
|
||||
return;
|
||||
}
|
||||
// 批量保存
|
||||
int limitCount = 1000;
|
||||
int result = 0;
|
||||
if (commonGBChannels.size() > limitCount) {
|
||||
for (int i = 0; i < commonGBChannels.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > commonGBChannels.size()) {
|
||||
toIndex = commonGBChannels.size();
|
||||
}
|
||||
result += commonGBChannelMapper.batchUpdate(commonGBChannels.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
result += commonGBChannelMapper.batchUpdate(commonGBChannels);
|
||||
}
|
||||
log.warn("[更新多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannels, CatalogEvent.UPDATE);
|
||||
}catch (Exception e) {
|
||||
log.warn("[更新多个通道] 发送失败,{}个", commonGBChannels.size(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(List<CommonGBChannel> commonGBChannels) {
|
||||
@@ -259,11 +289,17 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
result += commonGBChannelMapper.updateStatus(commonGBChannels);
|
||||
}
|
||||
log.warn("[更新多个通道状态] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannels, CatalogEvent.UPDATE);
|
||||
}catch (Exception e) {
|
||||
log.warn("[更新多个通道] 发送失败,{}个", commonGBChannels.size(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonGBChannel> queryByPlatformId(Integer platformId) {
|
||||
|
||||
return commonGBChannelMapper.queryByPlatformId(platformId);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
streamSession.remove(device.getDeviceId(), channel.getDeviceId(), ssrcInfo.getStream());
|
||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||
// 取消订阅消息监听
|
||||
subscribe.removeSubscribe(Hook.getInstance(HookType.on_media_arrival, "rtp", ssrcInfo.getStream(), mediaServerItem.getId()));
|
||||
subscribe.removeSubscribe(Hook.getInstance(HookType.on_media_arrival, "rtp", ssrcInfo.getStream()));
|
||||
}
|
||||
}else {
|
||||
log.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流:{},端口:{}, SSRC: {}",
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
||||
@@ -24,11 +25,8 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.hook.Hook;
|
||||
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
|
||||
import com.genersoft.iot.vmp.media.event.hook.HookType;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
@@ -598,10 +596,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
sendRtpItem.setPlayType(InviteStreamType.PUSH);
|
||||
if (streamPushItem != null) {
|
||||
// 从redis查询是否正在接收这个推流
|
||||
MediaArrivalEvent mediaArrivalEvent = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
||||
if (mediaArrivalEvent != null) {
|
||||
sendRtpItem.setServerId(mediaArrivalEvent.getServerId());
|
||||
sendRtpItem.setMediaServerId(mediaArrivalEvent.getMediaServer().getId());
|
||||
MediaInfo mediaInfo = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
||||
if (mediaInfo != null) {
|
||||
sendRtpItem.setServerId(mediaInfo.getServerId());
|
||||
sendRtpItem.setMediaServerId(mediaInfo.getMediaServer().getId());
|
||||
|
||||
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
||||
// 开始推流
|
||||
|
||||
Reference in New Issue
Block a user