[*] 资源释放优化

This commit is contained in:
acgist
2023-04-30 13:42:58 +08:00
parent 165655c4e6
commit d9915e3013
6 changed files with 106 additions and 66 deletions

View File

@@ -1,5 +1,7 @@
package com.acgist.taoyao.signal.client;
import java.util.stream.Stream;
import com.acgist.taoyao.boot.model.MessageCodeException;
import lombok.Getter;
@@ -55,4 +57,13 @@ public enum ClientType {
throw MessageCodeException.of("未知终端类型:" + value);
}
/**
* 媒体终端
*/
public static final ClientType[] MEDIA_CLIENT = Stream.of(ClientType.values()).filter(ClientType::mediaClient).toArray(ClientType[]::new);
/**
* 媒体服务
*/
public static final ClientType[] MEDIA_SERVER = Stream.of(ClientType.values()).filter(ClientType::mediaServer).toArray(ClientType[]::new);
}

View File

@@ -103,6 +103,7 @@ public class RoomManager {
// mediaClient.request(clone);
// 更新媒体服务
room.setMediaClient(mediaClient);
// TODO通知重建房间
});
}

View File

@@ -66,7 +66,8 @@ public class RoomCreateProtocol extends ProtocolClientAdapter implements Applica
message.cloneWithoutBody()
);
message.setBody(room.getRoomStatus());
this.clientManager.broadcast(message);
// 通知媒体终端
this.clientManager.broadcast(message, ClientType.MEDIA_CLIENT);
} else {
this.logNoAdapter(clientType);
}