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