[*] 日常优化
This commit is contained in:
@@ -1080,23 +1080,22 @@ class Taoyao {
|
||||
* @param {*} body 消息主体
|
||||
*/
|
||||
async mediaConsumerSetPriority(message, body) {
|
||||
const me = this;
|
||||
const {
|
||||
roomId,
|
||||
consumerId,
|
||||
priority,
|
||||
} = body;
|
||||
const room = me.rooms.get(roomId);
|
||||
const room = this.rooms.get(roomId);
|
||||
const consumer = room?.consumers.get(consumerId);
|
||||
if(consumer) {
|
||||
console.debug("设置消费者优先级", consumerId, priority);
|
||||
if(priority <= 0 || priority >= 256) {
|
||||
await consumer.unsetPriority();
|
||||
} else {
|
||||
await consumer.setPriority(priority);
|
||||
}
|
||||
if(!consumer) {
|
||||
console.debug("设置消费者优先级(消费者无效)", roomId, consumerId);
|
||||
return;
|
||||
}
|
||||
console.debug("设置消费者优先级", consumerId, priority);
|
||||
if(priority <= 0 || priority >= 256) {
|
||||
await consumer.unsetPriority();
|
||||
} else {
|
||||
console.debug("设置消费者优先级(无效)", consumerId);
|
||||
await consumer.setPriority(priority);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1587,11 +1587,11 @@ class Taoyao extends RemoteClient {
|
||||
const me = this;
|
||||
const consumer = me.consumers.get(consumerId);
|
||||
if(!consumer) {
|
||||
me.platformError("请求关键帧消费者无效");
|
||||
me.platformError("消费者无效");
|
||||
return;
|
||||
}
|
||||
if(consumer.kind !== "video") {
|
||||
me.platformError("只能请求视频消费者关键帧");
|
||||
me.platformError("只能请求视频消费者");
|
||||
return;
|
||||
}
|
||||
me.push(protocol.buildMessage("media::consumer::request::key::frame", {
|
||||
@@ -1662,11 +1662,11 @@ class Taoyao extends RemoteClient {
|
||||
const me = this;
|
||||
const consumer = me.consumers.get(consumerId);
|
||||
if(!consumer) {
|
||||
me.platformError("修改最佳空间层和时间层消费者无效");
|
||||
me.platformError("消费者无效");
|
||||
return;
|
||||
}
|
||||
if(consumer.kind !== "video") {
|
||||
me.platformError("只能修改视频消费者最佳空间层和时间层");
|
||||
me.platformError("只能修改视频消费者");
|
||||
return;
|
||||
}
|
||||
me.push(protocol.buildMessage("media::consumer::set::preferred::layers", {
|
||||
@@ -1677,26 +1677,6 @@ class Taoyao extends RemoteClient {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置消费者优先级信令
|
||||
*
|
||||
* @param {*} consumerId 消费者ID
|
||||
* @param {*} priority 优先级:1~255
|
||||
*/
|
||||
mediaConsumerSetPriority(consumerId, priority) {
|
||||
const me = this;
|
||||
const consumer = me.consumers.get(consumerId);
|
||||
if(!consumer) {
|
||||
me.platformError("设置消费者优先级消费者无效");
|
||||
return;
|
||||
}
|
||||
me.push(protocol.buildMessage("media::consumer::set::priority", {
|
||||
roomId: me.roomId,
|
||||
consumerId,
|
||||
priority,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费媒体信令
|
||||
*
|
||||
@@ -1803,6 +1783,25 @@ class Taoyao extends RemoteClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置消费者优先级信令
|
||||
*
|
||||
* @param {*} consumerId 消费者ID
|
||||
* @param {*} priority 优先级:1~255
|
||||
*/
|
||||
mediaConsumerSetPriority(consumerId, priority) {
|
||||
const consumer = this.consumers.get(consumerId);
|
||||
if(!consumer) {
|
||||
this.platformError("消费者无效");
|
||||
return;
|
||||
}
|
||||
this.push(protocol.buildMessage("media::consumer::set::priority", {
|
||||
priority,
|
||||
consumerId,
|
||||
roomId: this.roomId,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消费者状态信令
|
||||
*
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
||||
*/
|
||||
@Protocol
|
||||
@Description(
|
||||
memo = "如果优先级不在范围内表示取消优先级设置",
|
||||
body = """
|
||||
{
|
||||
"roomId" : "房间ID",
|
||||
|
||||
Reference in New Issue
Block a user