[*] 日常优化
This commit is contained in:
@@ -1693,7 +1693,11 @@ class Taoyao {
|
||||
* @param {*} body 消息主体
|
||||
*/
|
||||
async mediaTransportWebrtcConnect(message, body) {
|
||||
const { roomId, transportId, dtlsParameters } = body;
|
||||
const {
|
||||
roomId,
|
||||
transportId,
|
||||
dtlsParameters
|
||||
} = body;
|
||||
const room = this.rooms.get(roomId);
|
||||
const transport = room?.transports.get(transportId);
|
||||
if(transport) {
|
||||
|
||||
@@ -24,9 +24,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Description(
|
||||
body = {
|
||||
"""
|
||||
{
|
||||
"roomId" : "房间ID",
|
||||
"transportId" : "通道ID"
|
||||
"dtlsParameters": "DTLS参数"
|
||||
}
|
||||
"""
|
||||
},
|
||||
flow = "终端->信令服务->媒体服务->信令服务->终端"
|
||||
flow = "终端=>信令服务->媒体服务"
|
||||
)
|
||||
public class MediaTransportWebRtcConnectProtocol extends ProtocolRoomAdapter {
|
||||
|
||||
@@ -45,7 +50,7 @@ public class MediaTransportWebRtcConnectProtocol extends ProtocolRoomAdapter {
|
||||
final String transportId = MapUtils.get(responseBody, Constant.TRANSPORT_ID);
|
||||
log.info("{}连接WebRTC通道信令:{}", clientId, transportId);
|
||||
} else {
|
||||
// 忽略其他情况
|
||||
this.logNoAdapter(clientType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,19 +34,23 @@ import lombok.extern.slf4j.Slf4j;
|
||||
body = {
|
||||
"""
|
||||
{
|
||||
"roomId": "房间标识"
|
||||
"roomId" : "房间标识",
|
||||
"forceTcp" : "强制使用TCP",
|
||||
"producing" : "是否生产",
|
||||
"consuming" : "是否消费",
|
||||
"sctpCapabilities": "sctpCapabilities"
|
||||
}
|
||||
{
|
||||
"roomId": "房间标识",
|
||||
"transportId": "传输通道标识",
|
||||
"iceCandidates": "iceCandidates",
|
||||
"iceParameters": "iceParameters",
|
||||
"roomId" : "房间标识",
|
||||
"transportId" : "传输通道标识",
|
||||
"iceCandidates" : "iceCandidates",
|
||||
"iceParameters" : "iceParameters",
|
||||
"dtlsParameters": "dtlsParameters",
|
||||
"sctpParameters": "sctpParameters"
|
||||
}
|
||||
"""
|
||||
},
|
||||
flow = "终端->信令服务->媒体服务->信令服务->终端"
|
||||
flow = "终端=>信令服务->媒体服务"
|
||||
)
|
||||
public class MediaTransportWebRtcCreateProtocol extends ProtocolRoomAdapter {
|
||||
|
||||
@@ -58,6 +62,7 @@ public class MediaTransportWebRtcCreateProtocol extends ProtocolRoomAdapter {
|
||||
|
||||
@Override
|
||||
public void execute(String clientId, ClientType clientType, Room room, Client client, Client mediaClient, Message message, Map<String, Object> body) {
|
||||
if(clientType.mediaClient()) {
|
||||
body.put(Constant.CLIENT_ID, clientId);
|
||||
final Message response = room.requestMedia(message);
|
||||
final Map<String, Object> responseBody = response.body();
|
||||
@@ -99,6 +104,9 @@ public class MediaTransportWebRtcCreateProtocol extends ProtocolRoomAdapter {
|
||||
}
|
||||
client.push(response);
|
||||
log.info("{}创建WebRTC通道信令:{}", clientId, transportId);
|
||||
} else {
|
||||
this.logNoAdapter(clientType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,12 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
||||
@Protocol
|
||||
@Description(
|
||||
body = """
|
||||
{
|
||||
"roomId" : "房间ID",
|
||||
"camera" : "是否摄像头",
|
||||
"flip" : "是否翻转",
|
||||
"rotation": "旋转角度"
|
||||
}
|
||||
""",
|
||||
flow = "媒体服务->信令服务->终端"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user