[*] 日常优化

This commit is contained in:
acgist
2023-09-22 07:47:56 +08:00
parent 107a9e301d
commit 295693cba5
3 changed files with 29 additions and 24 deletions

View File

@@ -1107,23 +1107,22 @@ class Taoyao {
* @param {*} body 消息主体 * @param {*} body 消息主体
*/ */
async mediaConsumerStatus(message, body) { async mediaConsumerStatus(message, body) {
const me = this;
const { const {
roomId, roomId,
consumerId, consumerId,
} = body; } = body;
const room = me.rooms.get(roomId); const room = this.rooms.get(roomId);
const consumer = room?.consumers.get(consumerId); const consumer = room?.consumers.get(consumerId);
if(consumer) { if(!consumer) {
console.debug("查询消费者状态", consumerId); console.debug("查询消费者状态(消费者无效)", roomId, consumerId);
message.body = { return;
...body,
status: await consumer.getStats()
};
me.push(message);
} else {
console.debug("查询消费者状态(无效)", consumerId);
} }
console.debug("查询消费者状态", consumerId);
message.body = {
...body,
status: await consumer.getStats()
};
this.push(message);
} }
/** /**

View File

@@ -1697,19 +1697,6 @@ class Taoyao extends RemoteClient {
})); }));
} }
/**
* 查询消费者状态信令
*
* @param {*} consumerId 消费者ID
*/
async mediaConsumerStatus(consumerId) {
const me = this;
return await me.request(protocol.buildMessage('media::consumer::status', {
roomId: me.roomId,
consumerId
}));
}
/** /**
* 消费媒体信令 * 消费媒体信令
* *
@@ -1816,6 +1803,18 @@ class Taoyao extends RemoteClient {
} }
} }
/**
* 查询消费者状态信令
*
* @param {*} consumerId 消费者ID
*/
async mediaConsumerStatus(consumerId) {
return await this.request(protocol.buildMessage("media::consumer::status", {
consumerId,
roomId: this.roomId,
}));
}
/** /**
* 消费数据信令 * 消费数据信令
* *

View File

@@ -22,6 +22,13 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
"roomId" : "房间ID", "roomId" : "房间ID",
"consumerId": "消费者ID" "consumerId": "消费者ID"
} }
{
"roomId" : "房间ID",
"consumerId": "消费者ID",
"status" : [
...状态信息
]
}
""", """,
flow = "终端=>信令服务->媒体服务" flow = "终端=>信令服务->媒体服务"
) )