国标级联推送推流 支持多wvp间自动选择与推送

This commit is contained in:
648540858
2022-06-14 14:37:34 +08:00
parent c827d1518b
commit e0344ccf97
37 changed files with 1831 additions and 664 deletions

View File

@@ -356,6 +356,15 @@ public interface IVideoManagerStorage {
int removeMedia(String app, String stream);
/**
* 获取但个推流
* @param app
* @param stream
* @return
*/
StreamPushItem getMedia(String app, String stream);
/**
* 清空推流列表
*/

View File

@@ -14,9 +14,9 @@ import java.util.List;
public interface StreamPushMapper {
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
"createStamp, aliveSecond, mediaServerId) VALUES" +
"createStamp, aliveSecond, mediaServerId, serverId) VALUES" +
"('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
"'${createStamp}', '${aliveSecond}', '${mediaServerId}' )")
"'${createStamp}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' )")
int add(StreamPushItem streamPushItem);
@Update("UPDATE stream_push " +

View File

@@ -587,11 +587,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*";
List<GPSMsgInfo> result = new ArrayList<>();
List<Object> keys = redis.scan(scanKey);
for (int i = 0; i < keys.size(); i++) {
String key = (String) keys.get(i);
for (Object o : keys) {
String key = (String) o;
GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key);
if (!gpsMsgInfo.isStored()) { // 只取没有存过得
result.add((GPSMsgInfo)redis.get(key));
result.add((GPSMsgInfo) redis.get(key));
}
}
@@ -667,7 +667,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendStreamPushRequestedMsg(MessageForPushChannel msg) {
String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED;
logger.info("[redis 推流被请求通知] {}: {}-{}", key, msg.getApp(), msg.getStream());
logger.info("[redis 推流被请求通知] {}: {}/{}", key, msg.getApp(), msg.getStream());
redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
}

View File

@@ -884,6 +884,11 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
return streamPushMapper.del(app, stream);
}
@Override
public StreamPushItem getMedia(String app, String stream) {
return streamPushMapper.selectOne(app, stream);
}
@Override
public void clearMediaList() {
streamPushMapper.clear();