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