优化推流结束时流类型的获取

This commit is contained in:
lin
2022-01-08 18:00:31 +08:00
parent abb60593cb
commit 098dd8a045
5 changed files with 54 additions and 42 deletions

View File

@@ -343,24 +343,16 @@ public class ZLMHttpHookListener {
MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
if (mediaServerItem != null){
if (regist) {
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
redisCatchStorage.addStream(mediaServerItem, type, app, streamId, streamInfo);
redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|| item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|| item.getOriginType() == OriginType.RTC_PUSH.ordinal() ) {
zlmMediaListManager.addPush(item);
}
}else {
// 兼容流注销时类型错误的问题等zlm更新后删除
StreamPushItem streamPushItem = streamPushService.getPush(app, streamId);
if (streamPushItem != null) {
type = "PUSH";
}else {
StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(app, streamId);
if (streamProxyByAppAndStream != null) {
type = "PULL";
}
}
// 兼容流注销时类型从redis记录获取
MediaItem mediaItem = redisCatchStorage.getStreamInfo(app, streamId, mediaServerId);
type = OriginType.values()[mediaItem.getOriginType()].getType();
zlmMediaListManager.removeMedia(app, streamId);
redisCatchStorage.removeStream(mediaServerItem.getId(), type, app, streamId);
}