[*] 日常优化
This commit is contained in:
@@ -38,5 +38,6 @@
|
|||||||
* 安卓关闭视频没有删除预览
|
* 安卓关闭视频没有删除预览
|
||||||
* 浏览器WebRTC监控页面关闭:`chrome://webrtc-internals/`
|
* 浏览器WebRTC监控页面关闭:`chrome://webrtc-internals/`
|
||||||
* me -> this
|
* me -> this
|
||||||
|
* console -> platformError
|
||||||
|
|
||||||
## 完成任务
|
## 完成任务
|
||||||
|
|||||||
@@ -999,21 +999,23 @@ class Taoyao {
|
|||||||
/**
|
/**
|
||||||
* 请求关键帧信令
|
* 请求关键帧信令
|
||||||
*
|
*
|
||||||
* @param {*} message 消息
|
* @param {*} message 信令消息
|
||||||
* @param {*} body 消息主体
|
* @param {*} body 消息主体
|
||||||
*/
|
*/
|
||||||
async mediaConsumerRequestKeyFrame(message, body) {
|
async mediaConsumerRequestKeyFrame(message, body) {
|
||||||
const me = this;
|
const {
|
||||||
const { roomId, consumerId } = body;
|
roomId,
|
||||||
const room = me.rooms.get(roomId);
|
consumerId
|
||||||
|
} = body;
|
||||||
|
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);
|
||||||
// 通过trace事件监听关键帧的信息
|
return;
|
||||||
await consumer.requestKeyFrame();
|
|
||||||
} else {
|
|
||||||
console.debug("请求关键帧(无效)", consumerId);
|
|
||||||
}
|
}
|
||||||
|
console.debug("请求关键帧", consumerId);
|
||||||
|
// 通过trace事件监听关键帧的信息
|
||||||
|
await consumer.requestKeyFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1030,7 +1032,7 @@ class Taoyao {
|
|||||||
const room = this.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.warn("恢复消费者(消费者无效)", consumerId);
|
console.warn("恢复消费者(消费者无效)", roomId, consumerId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
consumer.localPaused = false;
|
consumer.localPaused = false;
|
||||||
|
|||||||
@@ -1578,28 +1578,6 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求关键帧信令
|
|
||||||
*
|
|
||||||
* @param {*} consumerId 消费者ID
|
|
||||||
*/
|
|
||||||
mediaConsumerRequestKeyFrame(consumerId) {
|
|
||||||
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::request::key::frame", {
|
|
||||||
roomId : me.roomId,
|
|
||||||
consumerId: consumerId,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消费媒体信令
|
* 消费媒体信令
|
||||||
*
|
*
|
||||||
@@ -1706,6 +1684,27 @@ class Taoyao extends RemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求关键帧信令
|
||||||
|
*
|
||||||
|
* @param {*} consumerId 消费者ID
|
||||||
|
*/
|
||||||
|
mediaConsumerRequestKeyFrame(consumerId) {
|
||||||
|
const consumer = this.consumers.get(consumerId);
|
||||||
|
if(!consumer) {
|
||||||
|
this.platformError("消费者无效");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(consumer.kind !== "video") {
|
||||||
|
this.platformError("只能请求视频消费者");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.push(protocol.buildMessage("media::consumer::request::key::frame", {
|
||||||
|
consumerId,
|
||||||
|
roomId: this.roomId,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 恢复消费者信令
|
* 恢复消费者信令
|
||||||
*
|
*
|
||||||
@@ -2724,7 +2723,10 @@ class Taoyao extends RemoteClient {
|
|||||||
if(message instanceof Object) {
|
if(message instanceof Object) {
|
||||||
callbackMessage = message;
|
callbackMessage = message;
|
||||||
} else {
|
} else {
|
||||||
callbackMessage = protocol.buildMessage("platform::error", {});
|
callbackMessage = protocol.buildMessage("platform::error", {
|
||||||
|
error,
|
||||||
|
message,
|
||||||
|
});
|
||||||
callbackMessage.code = "9999";
|
callbackMessage.code = "9999";
|
||||||
callbackMessage.message = message;
|
callbackMessage.message = message;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求关键帧信令
|
* 请求关键帧信令
|
||||||
* 注意:视频才有
|
*
|
||||||
|
* 注意:视频消费者才有
|
||||||
*
|
*
|
||||||
* @author acgist
|
* @author acgist
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
*
|
*
|
||||||
* 码率:数据大小和时间的比值
|
* 码率:数据大小和时间的比值
|
||||||
*
|
*
|
||||||
* 注意:只有Simulcast和SVC消费者有效
|
* 注意:只有Simulcast和SVC视频消费者有效
|
||||||
*
|
*
|
||||||
* @author acgist
|
* @author acgist
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user