修复推流关联平台的bug again
This commit is contained in:
parent
21367a09a6
commit
ce2e412c69
@ -46,4 +46,9 @@ public class SubscribeHolder {
|
||||
}
|
||||
return platforms;
|
||||
}
|
||||
|
||||
public void removeAllSubscribe(String platformId) {
|
||||
mobilePositionMap.remove(platformId);
|
||||
catalogMap.remove(platformId);
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class ZLMMediaListManager {
|
||||
if (gbStreams.size() > 0) {
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
// 出现使用相同国标Id的视频流时,使用新流替换旧流,
|
||||
if (queryKey != null) {
|
||||
if (queryKey != null && gbStream.getApp().equals(mediaItem.getApp())) {
|
||||
Matcher matcherForStream = pattern.matcher(gbStream.getStream());
|
||||
String queryKeyForStream = null;
|
||||
if (matcherForStream.find()) { //此处find()每次被调用后,会偏移到下一个匹配
|
||||
@ -144,12 +144,15 @@ public class ZLMMediaListManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream());
|
||||
if (streamProxyItem != null) {
|
||||
transform.setGbStreamId(streamProxyItem.getGbStreamId());
|
||||
transform.setPlatformId(streamProxyItem.getPlatformId());
|
||||
transform.setCatalogId(streamProxyItem.getCatalogId());
|
||||
// StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream());
|
||||
List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId());
|
||||
if (gbStreamList != null && gbStreamList.size() == 1) {
|
||||
transform.setGbStreamId(gbStreamList.get(0).getGbStreamId());
|
||||
transform.setPlatformId(gbStreamList.get(0).getPlatformId());
|
||||
transform.setCatalogId(gbStreamList.get(0).getCatalogId());
|
||||
transform.setGbId(gbStreamList.get(0).getGbId());
|
||||
gbStreamMapper.update(transform);
|
||||
streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());
|
||||
}else {
|
||||
transform.setCreateStamp(System.currentTimeMillis());
|
||||
gbStreamMapper.add(transform);
|
||||
|
@ -33,6 +33,19 @@ public interface GbStreamMapper {
|
||||
"mediaServerId=#{mediaServerId}," +
|
||||
"status=${status} " +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
int updateByallAndStream(GbStream gbStream);
|
||||
|
||||
@Update("UPDATE gb_stream " +
|
||||
"SET app=#{app}," +
|
||||
"stream=#{stream}," +
|
||||
"gbId=#{gbId}," +
|
||||
"name=#{name}," +
|
||||
"streamType=#{streamType}," +
|
||||
"longitude=#{longitude}, " +
|
||||
"latitude=#{latitude}," +
|
||||
"mediaServerId=#{mediaServerId}," +
|
||||
"status=${status} " +
|
||||
"WHERE gbStreamId=#{gbStreamId}")
|
||||
int update(GbStream gbStream);
|
||||
|
||||
@Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||
|
@ -772,7 +772,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
try {
|
||||
if (streamProxyMapper.update(streamProxyItem) > 0) {
|
||||
if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
|
||||
if (gbStreamMapper.update(streamProxyItem) > 0) {
|
||||
if (gbStreamMapper.updateByallAndStream(streamProxyItem) > 0) {
|
||||
//事务回滚
|
||||
dataSourceTransactionManager.rollback(transactionStatus);
|
||||
return false;
|
||||
|
@ -305,6 +305,8 @@ public class PlatformController {
|
||||
// 停止发送位置订阅定时任务
|
||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
||||
dynamicTask.stop(key);
|
||||
// 删除缓存的订阅信息
|
||||
subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
|
||||
if (deleteResult) {
|
||||
return new ResponseEntity<>("success", HttpStatus.OK);
|
||||
} else {
|
||||
@ -341,7 +343,6 @@ public class PlatformController {
|
||||
* @param platformId 上级平台ID
|
||||
* @param query 查询内容
|
||||
* @param online 是否在线
|
||||
* @param choosed 是否已选中
|
||||
* @param channelType 通道类型
|
||||
* @return
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user