[*] 日常优化

This commit is contained in:
acgist
2023-09-24 08:05:35 +08:00
parent af94347100
commit 69b5bedd07
2 changed files with 35 additions and 37 deletions

View File

@@ -1049,28 +1049,27 @@ class Taoyao {
/**
* 修改最佳空间层和时间层信令
*
* @param {*} message 消息
* @param {*} message 信令消息
* @param {*} body 消息主体
*/
async mediaConsumerSetPreferredLayers(message, body) {
const me = this;
const {
roomId,
consumerId,
spatialLayer,
temporalLayer,
} = body;
const room = me.rooms.get(roomId);
const room = this.rooms.get(roomId);
const consumer = room?.consumers.get(consumerId);
if(consumer) {
console.debug("修改最佳空间层和时间层", consumerId);
await consumer.setPreferredLayers({
spatialLayer,
temporalLayer
});
} else {
console.debug("修改最佳空间层和时间层(无效)", consumerId);
if(!consumer) {
console.debug("修改最佳空间层和时间层(消费者无效)", roomId, consumerId);
return;
}
console.debug("修改最佳空间层和时间层", consumerId);
await consumer.setPreferredLayers({
spatialLayer,
temporalLayer
});
}
/**

View File

@@ -1651,32 +1651,6 @@ class Taoyao extends RemoteClient {
console.debug("消费者评分", message);
}
/**
* 修改最佳空间层和时间层信令
*
* @param {*} consumerId 消费者ID
* @param {*} spatialLayer 空间层
* @param {*} temporalLayer 时间层
*/
mediaConsumerSetPreferredLayers(consumerId, spatialLayer, temporalLayer) {
const me = this;
const consumer = me.consumers.get(consumerId);
if(!consumer) {
me.platformError("消费者无效");
return;
}
if(consumer.kind !== "video") {
me.platformError("只能修改视频消费者");
return;
}
me.push(protocol.buildMessage("media::consumer::set::preferred::layers", {
roomId: me.roomId,
consumerId,
spatialLayer,
temporalLayer,
}));
}
/**
* 消费媒体信令
*
@@ -1783,6 +1757,31 @@ class Taoyao extends RemoteClient {
}
}
/**
* 修改最佳空间层和时间层信令
*
* @param {*} consumerId 消费者ID
* @param {*} spatialLayer 空间层
* @param {*} temporalLayer 时间层
*/
mediaConsumerSetPreferredLayers(consumerId, spatialLayer, temporalLayer) {
const consumer = this.consumers.get(consumerId);
if(!consumer) {
this.platformError("消费者无效");
return;
}
if(consumer.kind !== "video") {
this.platformError("只能修改视频消费者");
return;
}
this.push(protocol.buildMessage("media::consumer::set::preferred::layers", {
consumerId,
spatialLayer,
temporalLayer,
roomId: this.roomId,
}));
}
/**
* 设置消费者优先级信令
*