修复推流推流状态提示
This commit is contained in:
@@ -299,18 +299,6 @@ public interface IVideoManagerStorage {
|
||||
*/
|
||||
List<DeviceChannel> queryGbStreamListInPlatform(String platformId);
|
||||
|
||||
/**
|
||||
* 批量更新推流列表
|
||||
* @param streamPushItems
|
||||
*/
|
||||
void updateMediaList(List<StreamPushItem> streamPushItems);
|
||||
|
||||
/**
|
||||
* 更新单个推流
|
||||
* @param streamPushItem
|
||||
*/
|
||||
void updateMedia(StreamPushItem streamPushItem);
|
||||
|
||||
/**
|
||||
* 移除单个推流
|
||||
* @param app
|
||||
@@ -318,21 +306,6 @@ public interface IVideoManagerStorage {
|
||||
*/
|
||||
int removeMedia(String app, String stream);
|
||||
|
||||
|
||||
/**
|
||||
* 获取但个推流
|
||||
* @param app
|
||||
* @param stream
|
||||
* @return
|
||||
*/
|
||||
StreamPushItem getMedia(String app, String stream);
|
||||
|
||||
|
||||
/**
|
||||
* 清空推流列表
|
||||
*/
|
||||
void clearMediaList();
|
||||
|
||||
/**
|
||||
* 设置流离线
|
||||
*/
|
||||
|
||||
@@ -15,9 +15,10 @@ import java.util.List;
|
||||
public interface StreamPushMapper {
|
||||
|
||||
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
|
||||
"pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng) VALUES" +
|
||||
"pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng, self) VALUES" +
|
||||
"('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
|
||||
"'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', ${pushIng} )")
|
||||
"'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', " +
|
||||
"${pushIng}, ${self} )")
|
||||
int add(StreamPushItem streamPushItem);
|
||||
|
||||
|
||||
@@ -31,6 +32,7 @@ public interface StreamPushMapper {
|
||||
"<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" +
|
||||
"<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" +
|
||||
"<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" +
|
||||
"<if test=\"self != null\">, self=${self}</if>" +
|
||||
"WHERE app=#{app} AND stream=#{stream}"+
|
||||
" </script>"})
|
||||
int update(StreamPushItem streamPushItem);
|
||||
@@ -119,7 +121,7 @@ public interface StreamPushMapper {
|
||||
@Update("UPDATE stream_push " +
|
||||
"SET pushIng=${pushIng} " +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
int updatePushStatus(String app, String stream, boolean status);
|
||||
int updatePushStatus(String app, String stream, boolean pushIng);
|
||||
|
||||
@Update("UPDATE stream_push " +
|
||||
"SET status=#{status} " +
|
||||
|
||||
@@ -479,7 +479,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void sendStreamChangeMsg(String type, JSONObject jsonObject) {
|
||||
String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type;
|
||||
logger.debug("[redis 流变化事件] {}: {}", key, jsonObject.toString());
|
||||
logger.info("[redis 流变化事件] {}: {}", key, jsonObject.toString());
|
||||
redis.convertAndSend(key, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -635,47 +635,11 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
return streamProxyMapper.selectOne(app, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMediaList(List<StreamPushItem> streamPushItems) {
|
||||
if (streamPushItems == null || streamPushItems.size() == 0) {
|
||||
return;
|
||||
}
|
||||
logger.info("updateMediaList: " + streamPushItems.size());
|
||||
streamPushMapper.addAll(streamPushItems);
|
||||
// TODO 待优化
|
||||
for (int i = 0; i < streamPushItems.size(); i++) {
|
||||
int onlineResult = mediaOnline(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream());
|
||||
if (onlineResult > 0) {
|
||||
// 发送上线通知
|
||||
eventPublisher.catalogEventPublishForStream(null, streamPushItems.get(i), CatalogEvent.ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateMedia(StreamPushItem streamPushItem) {
|
||||
streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
|
||||
streamPushMapper.add(streamPushItem);
|
||||
mediaOffline(streamPushItem.getApp(), streamPushItem.getStream());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeMedia(String app, String stream) {
|
||||
return streamPushMapper.del(app, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamPushItem getMedia(String app, String stream) {
|
||||
return streamPushMapper.selectOne(app, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMediaList() {
|
||||
streamPushMapper.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int mediaOffline(String app, String stream) {
|
||||
GbStream gbStream = gbStreamMapper.selectOne(app, stream);
|
||||
@@ -683,7 +647,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
if ("proxy".equals(gbStream.getStreamType())) {
|
||||
result = streamProxyMapper.updateStatus(app, stream, false);
|
||||
}else {
|
||||
result = streamPushMapper.updateStatus(app, stream, false);
|
||||
result = streamPushMapper.updatePushStatus(app, stream, false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -695,7 +659,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
if ("proxy".equals(gbStream.getStreamType())) {
|
||||
result = streamProxyMapper.updateStatus(app, stream, true);
|
||||
}else {
|
||||
result = streamPushMapper.updateStatus(app, stream, true);
|
||||
result = streamPushMapper.updatePushStatus(app, stream, true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user