[*] 拉取bug
This commit is contained in:
@@ -4,11 +4,13 @@
|
||||
|
||||
```
|
||||
CentOS:CentOS Linux release 7.9.2009 (Core)
|
||||
Java >= 17
|
||||
Maven >= 3.6.0
|
||||
gcc/g++ >= 4.9
|
||||
pm2 >= 5.2.0
|
||||
git >= 1.8.0
|
||||
Java >= 17.0.0
|
||||
Maven >= 3.8.0
|
||||
gcc/g++ >= 10.0.0
|
||||
node version >= v16.0.0
|
||||
python version >= 3.6 with PIP
|
||||
python version >= 3.8.0 with PIP
|
||||
```
|
||||
|
||||
## 设置Yum源
|
||||
@@ -121,8 +123,12 @@ ln -sf /data/nodejs/node-v16.19.0-linux-x64/bin/pm2 /usr/local/bin/
|
||||
|
||||
# 日志
|
||||
pm2 install pm2-logrotate
|
||||
pm2 set pm2-logrotate-ext:retain 14
|
||||
pm2 set pm2-logrotate-ext:max_size 256M
|
||||
pm2 set pm2-logrotate:retain 14
|
||||
pm2 set pm2-logrotate:compress true
|
||||
pm2 set pm2-logrotate:max_size 256M
|
||||
|
||||
# 查看配置
|
||||
pm2 conf
|
||||
|
||||
# 自启
|
||||
pm2 startup
|
||||
@@ -142,7 +148,8 @@ tar -zxvf openjdk-17.0.2_linux-x64_bin.tar.gz
|
||||
vim ~/.bash_profile
|
||||
|
||||
---
|
||||
PATH=$PATH:/data/java/jdk-17.0.2/bin
|
||||
JAVA_HOME=/data/java/jdk-17.0.2
|
||||
PATH=$PATH:$JAVA_HOME/bin
|
||||
---
|
||||
|
||||
. ~/.bash_profile
|
||||
@@ -165,7 +172,8 @@ tar -zxvf apache-maven-3.8.6-bin.tar.gz
|
||||
vim ~/.bash_profile
|
||||
|
||||
---
|
||||
PATH=$PATH:/data/maven/apache-maven-3.8.6/bin
|
||||
MAVEN_HOME=/data/maven/apache-maven-3.8.6
|
||||
PATH=$PATH:$MAVEN_HOME/bin
|
||||
---
|
||||
|
||||
. ~/.bash_profile
|
||||
@@ -291,27 +299,7 @@ mvn clean package -D skipTests
|
||||
cp taoyao-server/target/taoyao-server-1.0.0/bin/deploy.sh ./
|
||||
|
||||
# 配置服务
|
||||
vim /usr/lib/systemd/system/taoyao-signal-server.service
|
||||
|
||||
---
|
||||
[Unit]
|
||||
Description=taoyao signal server
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Type=forking
|
||||
KillMode=process
|
||||
ExecStart=/data/taoyao/taoyao-signal-server/deploy/bin/startup.sh
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStop=/bin/kill -QUIT $MAINPID
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
---
|
||||
cp /data/taoyao/docs/etc/taoyao-signal-server.service /usr/lib/systemd/system/taoyao-signal-server.service
|
||||
|
||||
# 配置自启
|
||||
systemctl daemon-reload
|
||||
@@ -368,21 +356,7 @@ pm2 start | stop | restart taoyao-client-web
|
||||
npm run build
|
||||
|
||||
# Nginx配置
|
||||
vim /etc/nginx/conf.d/taoyao.cnf
|
||||
|
||||
---
|
||||
server {
|
||||
listen 8443 http2;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/taoyao.access.log main buffer=32k flush=10s;
|
||||
|
||||
location / {
|
||||
root /data/taoyao/taoyao-client-web/dist;
|
||||
index index.html;
|
||||
}
|
||||
}
|
||||
---
|
||||
cp /data/taoyao/docs/etc/nginx /etc/nginx/nginx.conf
|
||||
|
||||
nginx -s reload
|
||||
```
|
||||
|
||||
17
docs/etc/taoyao-signal-server.service
Normal file
17
docs/etc/taoyao-signal-server.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=taoyao signal server
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Type=forking
|
||||
KillMode=process
|
||||
ExecStart=/data/taoyao/taoyao-signal-server/deploy/bin/startup.sh
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStop=/bin/kill -QUIT $MAINPID
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -367,55 +367,57 @@ class Taoyao {
|
||||
* @param {*} message 消息
|
||||
*/
|
||||
on(message) {
|
||||
const me = this;
|
||||
// 请求回调
|
||||
if (this.callbackMapping.has(message.header.id)) {
|
||||
if (me.callbackMapping.has(message.header.id)) {
|
||||
try {
|
||||
this.callbackMapping.get(message.header.id)(message);
|
||||
me.callbackMapping.get(message.header.id)(message);
|
||||
} finally {
|
||||
this.callbackMapping.delete(message.header.id);
|
||||
me.callbackMapping.delete(message.header.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 执行信令
|
||||
const body = message.body;
|
||||
switch (message.header.signal) {
|
||||
case "client::reboot":
|
||||
this.clientReboot(message, body);
|
||||
me.clientReboot(message, body);
|
||||
break;
|
||||
case "client::shutdown":
|
||||
this.clientShutdown(message, body);
|
||||
me.clientShutdown(message, body);
|
||||
break;
|
||||
case "client::register":
|
||||
protocol.clientIndex = body.index;
|
||||
break;
|
||||
case "media::ice::restart":
|
||||
this.mediaIceRestart(message, body);
|
||||
me.mediaIceRestart(message, body);
|
||||
break;
|
||||
case "media::consume":
|
||||
this.mediaConsume(message, body);
|
||||
me.mediaConsume(message, body);
|
||||
break;
|
||||
case "media::consumer::close":
|
||||
me.mediaConsumerClose(message, body);
|
||||
break;
|
||||
case "media::produce":
|
||||
this.mediaProduce(message, body);
|
||||
me.mediaProduce(message, body);
|
||||
break;
|
||||
case "media::router::rtp::capabilities":
|
||||
this.mediaRouterRtpCapabilities(message, body);
|
||||
me.mediaRouterRtpCapabilities(message, body);
|
||||
break;
|
||||
case "media::transport::webrtc::connect":
|
||||
this.mediaTransportWebrtcConnect(message, body);
|
||||
me.mediaTransportWebrtcConnect(message, body);
|
||||
break;
|
||||
case "media::transport::webrtc::create":
|
||||
this.mediaTransportWebrtcCreate(message, body);
|
||||
me.mediaTransportWebrtcCreate(message, body);
|
||||
break;
|
||||
case "platform::error":
|
||||
this.platformError(message, body);
|
||||
me.platformError(message, body);
|
||||
break;
|
||||
case "room::create":
|
||||
this.roomCreate(message, body);
|
||||
me.roomCreate(message, body);
|
||||
break;
|
||||
case "room::close":
|
||||
this.roomClose(message, body);
|
||||
me.roomClose(message, body);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -718,9 +720,8 @@ class Taoyao {
|
||||
})
|
||||
);
|
||||
});
|
||||
// TODO:改为同步
|
||||
//await this.request("media::consume", {
|
||||
this.push(
|
||||
// 等待终端准备就绪
|
||||
this.request(
|
||||
protocol.buildMessage("media::consume", {
|
||||
kind: consumer.kind,
|
||||
type: consumer.type,
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<video ref="video"></video>
|
||||
<p class="title">{{ client?.name || "" }}</p>
|
||||
<div class="buttons" :style="{'--volume': client?.volume}">
|
||||
<el-button type="danger" title="打开麦克风" :icon="Mute" circle />
|
||||
<el-button type="primary" title="关闭麦克风" :icon="Microphone" circle />
|
||||
<el-button type="danger" title="打开摄像头" :icon="VideoPause" circle />
|
||||
<el-button type="primary" title="关闭摄像头" :icon="VideoPlay" circle />
|
||||
<el-button v-show="!client.audioActive" type="primary" title="打开麦克风" :icon="Microphone" circle />
|
||||
<el-button v-show="client.audioActive" type="danger" title="关闭麦克风" :icon="Mute" circle />
|
||||
<el-button v-show="!client.videoActive" type="primary" title="打开摄像头" :icon="VideoPlay" circle />
|
||||
<el-button v-show="client.videoActive" type="danger" title="关闭摄像头" :icon="VideoPause" circle />
|
||||
<el-button title="交换媒体" :icon="Refresh" circle />
|
||||
<el-button title="拍照" :icon="Camera" circle />
|
||||
<el-button title="录像" :icon="VideoCamera" circle />
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<video ref="video"></video>
|
||||
<p class="title">{{ client?.name || "" }}</p>
|
||||
<div class="buttons" :style="{'--volume': client?.volume}">
|
||||
<el-button v-show="!client.audioActive" type="danger" title="打开麦克风" :icon="Mute" circle />
|
||||
<el-button v-show="client.audioActive" type="primary" title="关闭麦克风" :icon="Microphone" circle />
|
||||
<el-button v-show="!client.videoActive" type="danger" title="打开摄像头" :icon="VideoPause" circle />
|
||||
<el-button v-show="client.videoActive" type="primary" title="关闭摄像头" :icon="VideoPlay" circle />
|
||||
<el-button v-show="!client.audioActive" type="primary" title="打开麦克风" :icon="Microphone" circle />
|
||||
<el-button v-show="client.audioActive" type="danger" title="关闭麦克风" :icon="Mute" circle />
|
||||
<el-button v-show="!client.videoActive" type="primary" title="打开摄像头" :icon="VideoPlay" circle />
|
||||
<el-button v-show="client.videoActive" type="danger" title="关闭摄像头" :icon="VideoPause" circle />
|
||||
<el-button title="拍照" :icon="Camera" circle />
|
||||
<el-button title="录像" :icon="VideoCamera" circle />
|
||||
<el-button title="媒体信息" :icon="InfoFilled" circle />
|
||||
|
||||
@@ -714,7 +714,7 @@ class Taoyao extends RemoteClient {
|
||||
remoteClient.audioTrack = track;
|
||||
remoteClient.audioConsumer = consumer;
|
||||
} else if(track.kind === 'video') {
|
||||
remoteClient.audioActive = false;
|
||||
remoteClient.videoActive = true;
|
||||
remoteClient.videoTrack = track;
|
||||
remoteClient.videoconsumer = consumer;
|
||||
} else {
|
||||
@@ -829,8 +829,8 @@ class Taoyao extends RemoteClient {
|
||||
protocol.buildMessage("room::enter", {
|
||||
roomId: roomId,
|
||||
password: password,
|
||||
rtpCapabilities: me.consume ? me.mediasoupDevice.rtpCapabilities : undefined,
|
||||
sctpCapabilities: me.consume && me.dataProduce ? me.mediasoupDevice.sctpCapabilities : undefined,
|
||||
rtpCapabilities: (me.audioConsume || me.videoConsume || me.audioProduce || me.videoProduce) ? me.mediasoupDevice.rtpCapabilities : undefined,
|
||||
sctpCapabilities: (me.dataConsume || me.dataProduce) ? me.mediasoupDevice.sctpCapabilities : undefined,
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -1113,7 +1113,8 @@ class Taoyao extends RemoteClient {
|
||||
// codec : this._mediasoupDevice.rtpCapabilities.codecs
|
||||
// .find((codec) => codec.mimeType.toLowerCase() === 'audio/pcma')
|
||||
});
|
||||
|
||||
self.audioActive = true;
|
||||
self.track = track;
|
||||
// TODO:加密解密
|
||||
// if (this._e2eKey && e2e.isSupported()) {
|
||||
// e2e.setupSenderTransform(this._micProducer.rtpSender);
|
||||
@@ -1233,6 +1234,8 @@ class Taoyao extends RemoteClient {
|
||||
} else {
|
||||
console.warn("终端没有实现服务代理:", self);
|
||||
}
|
||||
self.videoActive = true;
|
||||
self.track = track;
|
||||
let codec;
|
||||
let encodings;
|
||||
const codecOptions = {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Consumer implements Closeable {
|
||||
return;
|
||||
}
|
||||
this.close = true;
|
||||
log.info("关闭消费者:{}", this.consumerId);
|
||||
log.info("关闭消费者:{} - {}", this.streamId, this.consumerId);
|
||||
this.getProducer().remove(this.consumerId);
|
||||
this.consumerClient.getConsumers().remove(this.consumerId);
|
||||
EventPublisher.publishEvent(new MediaConsumerCloseEvent(this.consumerId, this.room));
|
||||
|
||||
@@ -75,7 +75,7 @@ public class Producer implements Closeable {
|
||||
return;
|
||||
}
|
||||
this.close = true;
|
||||
log.info("关闭生产者:{}", this.producerId);
|
||||
log.info("关闭生产者:{} - {}", this.streamId, this.producerId);
|
||||
this.consumers.forEach((k, v) -> v.close());
|
||||
this.producerClient.getProducers().remove(this.producerId);
|
||||
EventPublisher.publishEvent(new MediaProducerCloseEvent(this.producerId, this.room));
|
||||
|
||||
@@ -115,26 +115,21 @@ public class MediaConsumeProtocol extends ProtocolRoomAdapter implements Applica
|
||||
*/
|
||||
private void consume(Room room, ClientWrapper consumerClientWrapper, Producer producer, Message message) {
|
||||
final Client mediaClient = room.getMediaClient();
|
||||
final String consumerClientId = consumerClientWrapper.getClientId();
|
||||
final String streamId = producer.getStreamId() + "->" + consumerClientId;
|
||||
final ClientWrapper producerClientWrapper = producer.getProducerClient();
|
||||
final String producerClientId = producerClientWrapper.getClientId();
|
||||
if(consumerClientWrapper.consumed(producer)) {
|
||||
// TODO:没有清理干净
|
||||
// 消费通道准备就绪
|
||||
if(log.isDebugEnabled()) {
|
||||
log.debug("消费通道准备就绪:{} - {}", consumerClientWrapper.getClientId(), producer.getStreamId());
|
||||
}
|
||||
// 消费通道就绪
|
||||
mediaClient.push(message);
|
||||
log.info("{}消费通道就绪:{}", consumerClientId, streamId);
|
||||
} else {
|
||||
// 主动消费媒体
|
||||
if(log.isDebugEnabled()) {
|
||||
log.debug("消费媒体:{} - {}", consumerClientWrapper.getClientId(), producer.getStreamId());
|
||||
}
|
||||
final String clientId = consumerClientWrapper.getClientId();
|
||||
final String streamId = producer.getStreamId() + "->" + clientId;
|
||||
final Transport recvTransport = consumerClientWrapper.getRecvTransport();
|
||||
final ClientWrapper produceClientWrapper = producer.getProducerClient();
|
||||
final Map<String, Object> body = new HashMap<>();
|
||||
body.put(Constant.ROOM_ID, room.getRoomId());
|
||||
body.put(Constant.CLIENT_ID, clientId);
|
||||
body.put(Constant.SOURCE_ID, produceClientWrapper.getClientId());
|
||||
body.put(Constant.CLIENT_ID, consumerClientId);
|
||||
body.put(Constant.SOURCE_ID, producerClientId);
|
||||
body.put(Constant.STREAM_ID, streamId);
|
||||
body.put(Constant.PRODUCER_ID, producer.getProducerId());
|
||||
body.put(Constant.TRANSPORT_ID, recvTransport.getTransportId());
|
||||
@@ -142,6 +137,7 @@ public class MediaConsumeProtocol extends ProtocolRoomAdapter implements Applica
|
||||
body.put(Constant.SCTP_CAPABILITIES, consumerClientWrapper.getSctpCapabilities());
|
||||
message.setBody(body);
|
||||
mediaClient.push(message);
|
||||
log.info("{}主动消费媒体:{} - {}", consumerClientId, producerClientId, streamId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MediaConsumerCloseProtocol extends ProtocolRoomAdapter implements A
|
||||
final String consumerId = MapUtils.get(body, Constant.CONSUMER_ID);
|
||||
final Consumer consumer = room.consumer(consumerId);
|
||||
if(consumer == null) {
|
||||
log.warn("关闭消费者无效:{}", consumerId);
|
||||
log.debug("关闭消费者无效:{}", consumerId);
|
||||
} else {
|
||||
consumer.close();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MediaProduceProtocol extends ProtocolRoomAdapter {
|
||||
// 视频全收:广播音频
|
||||
// 全部不收:全部广播
|
||||
room.broadcast(responseMessage);
|
||||
log.info("{}生产媒体:{} - {} - {}", clientId, kind, streamId, producerId);
|
||||
log.info("{}生产媒体:{} - {}", clientId, streamId, producerId);
|
||||
this.publishEvent(new MediaConsumeEvent(room, producer));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user