[+] 架构优化:Moon=MCU+SFU
This commit is contained in:
22
README.md
22
README.md
@@ -1,7 +1,6 @@
|
|||||||
# 桃夭
|
# 桃夭
|
||||||
|
|
||||||
基于WebRTC实现信令服务,实现Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。<br />
|
桃夭是套`WebRTC`信令服务,综合`Mesh`、`MCU`和`SFU`三种媒体通信架构,支持直播会议两种场景。
|
||||||
项目提供WebRTC服务信令,终端已有H5示例,其他终端需要自己实现。
|
|
||||||
|
|
||||||
## 模块
|
## 模块
|
||||||
|
|
||||||
@@ -16,9 +15,8 @@
|
|||||||
|taoyao-server|服务|启动服务|
|
|taoyao-server|服务|启动服务|
|
||||||
|taoyao-meeting|会议|会议模式、广播模式、单人对讲|
|
|taoyao-meeting|会议|会议模式、广播模式、单人对讲|
|
||||||
|taoyao-webrtc|WebRTC|WebRTC模块|
|
|taoyao-webrtc|WebRTC|WebRTC模块|
|
||||||
|taoyao-webrtc-sfu|SFU架构|SFU架构|
|
|taoyao-webrtc-mesh|Mesh架构|Mesh架构|
|
||||||
|taoyao-webrtc-mcu|MCU架构|MCU架构|
|
|taoyao-webrtc-moon|Moon架构|Moon架构|
|
||||||
|taoyao-webrtc-mesh|MESH架构|MESH架构|
|
|
||||||
|taoyao-webrtc-kurento|kurento框架|WebRTC协议簇kurento实现|
|
|taoyao-webrtc-kurento|kurento框架|WebRTC协议簇kurento实现|
|
||||||
|
|
||||||
## 模块关系
|
## 模块关系
|
||||||
@@ -31,7 +29,7 @@
|
|||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| taoyao-media |
|
| taoyao-media |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| taoyao-sfu / taoyao-mcu | |
|
| taoyao-moon(MCU/SFU) | |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ taoyao-mesh +
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ taoyao-mesh +
|
||||||
| taoyao-kurento | |
|
| taoyao-kurento | |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
@@ -53,13 +51,17 @@
|
|||||||
|
|
||||||
* ~~直播~~
|
* ~~直播~~
|
||||||
* 会议:一对一、~~多对多~~
|
* 会议:一对一、~~多对多~~
|
||||||
* ~~媒体:录制、降噪、美颜等等~~
|
* ~~媒体:降噪、变声、美颜录制、等等~~
|
||||||
* 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能
|
* 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能
|
||||||
|
|
||||||
### MCU/SFU
|
### Moon
|
||||||
|
|
||||||
终端推流到服务端,由服务端处理后分流。
|
综合`MCU`/`SFU`两种架构,终端推流到服务端,由服务端处理后分流。
|
||||||
|
|
||||||
|
> 为什么叫`Moon`:因为这是古诗词中最美丽的意象
|
||||||
|
|
||||||
#### 注意事项
|
#### 注意事项
|
||||||
|
|
||||||
* 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server)
|
* 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server)
|
||||||
|
* 提供混音、变声、美颜、录制等等媒体功能
|
||||||
|
* 终端推送给服务端最高质量媒体,再由服务端根据订阅终端按配置分流。
|
||||||
|
|||||||
91
docs/nginx/nginx.conf
Normal file
91
docs/nginx/nginx.conf
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
|
||||||
|
events {
|
||||||
|
use epoll;
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main buffer=32k flush=10s;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/xml text/css text/plain text/javascript image/gif image/png image/jpg image/webp image/jpeg image/x-icon image/svg+xml application/json application/javascript font/woff application/octet-stream application/vnd.ms-fontobject;
|
||||||
|
gzip_min_length 1k;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
# tcp_nopush on;
|
||||||
|
server_tokens off;
|
||||||
|
keepalive_timeout 60;
|
||||||
|
client_max_body_size 16m;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
|
||||||
|
upstream taoyao {
|
||||||
|
server https://localhost:8888;
|
||||||
|
keepalive 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen 443 ssl default_server;
|
||||||
|
ssl_certificate /data/ssl/taoyao.acgist.pem;
|
||||||
|
ssl_certificate_key /data/ssl/taoyao.acgist.key;
|
||||||
|
error_page 497 https://$host:$server_port$request_uri;
|
||||||
|
return 301 https://taoyao.acgist.com$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name taoyao.acgist.com;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/taoyao.acgist.com.log main buffer=32k flush=10s;
|
||||||
|
|
||||||
|
ssl_certificate /data/ssl/taoyao.acgist.com.pem;
|
||||||
|
ssl_certificate_key /data/ssl/taoyao.acgist.com.key;
|
||||||
|
ssl_ciphers TLS13-AES-128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-CBC-SHA256:ECDHE-ECDSA-AES128-CBC-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_session_timeout 30m;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# proxy_http_version 1.1;
|
||||||
|
proxy_http_version 2.0;
|
||||||
|
|
||||||
|
# proxy_set_header Connection close;
|
||||||
|
proxy_set_header Connection keep-alive;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
# proxy_set_header Host $host:$server_port;
|
||||||
|
# proxy_set_header X-Scheme $scheme;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
# proxy_set_header X-Http-scheme $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Server $host;
|
||||||
|
|
||||||
|
add_header Strict-Transport-Security "max-age=15552000; includeSubdomains; preload";
|
||||||
|
|
||||||
|
location = /websocket.signal {
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
keepalive_timeout 1200s;
|
||||||
|
proxy_read_timeout 1200s;
|
||||||
|
proxy_send_timeout 1200s;
|
||||||
|
proxy_connect_timeout 30s;
|
||||||
|
proxy_pass taoyao;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass taoyao;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
0
docs/sequence/Kurento.iuml
Normal file
0
docs/sequence/Kurento.iuml
Normal file
17
pom.xml
17
pom.xml
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<url>https://gitee.com/acgist/taoyao</url>
|
<url>https://gitee.com/acgist/taoyao</url>
|
||||||
<name>taoyao</name>
|
<name>taoyao</name>
|
||||||
<description>桃夭:基于WebRTC实现信令服务,实现Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。</description>
|
<description>桃夭:桃夭是套WebRTC信令服务,综合Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。</description>
|
||||||
<inceptionYear>2022</inceptionYear>
|
<inceptionYear>2022</inceptionYear>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -143,21 +143,16 @@
|
|||||||
<artifactId>taoyao-webrtc</artifactId>
|
<artifactId>taoyao-webrtc</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc-sfu</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc-mcu</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.acgist</groupId>
|
<groupId>com.acgist</groupId>
|
||||||
<artifactId>taoyao-webrtc-mesh</artifactId>
|
<artifactId>taoyao-webrtc-mesh</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.acgist</groupId>
|
||||||
|
<artifactId>taoyao-webrtc-moon</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.acgist</groupId>
|
<groupId>com.acgist</groupId>
|
||||||
<artifactId>taoyao-webrtc-kurento</artifactId>
|
<artifactId>taoyao-webrtc-kurento</artifactId>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class BootAutoConfiguration {
|
|||||||
|
|
||||||
@Value("${spring.application.name:taoyao}")
|
@Value("${spring.application.name:taoyao}")
|
||||||
private String name;
|
private String name;
|
||||||
@Value("${taoyao.webrtc.framework:SFU}")
|
@Value("${taoyao.webrtc.framework:MOON}")
|
||||||
private String framework;
|
private String framework;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -24,18 +24,14 @@ public class WebrtcProperties {
|
|||||||
*/
|
*/
|
||||||
public enum Framework {
|
public enum Framework {
|
||||||
|
|
||||||
/**
|
|
||||||
* SFU架构
|
|
||||||
*/
|
|
||||||
SFU,
|
|
||||||
/**
|
|
||||||
* MCU架构
|
|
||||||
*/
|
|
||||||
MCU,
|
|
||||||
/**
|
/**
|
||||||
* MESH架构
|
* MESH架构
|
||||||
*/
|
*/
|
||||||
MESH;
|
MESH,
|
||||||
|
/**
|
||||||
|
* MOON架构
|
||||||
|
*/
|
||||||
|
MOON;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,21 +14,17 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>taoyao-media</name>
|
<name>taoyao-media</name>
|
||||||
<description>媒体:录制、视频(美颜、AI识别)、音频(混音、变声、降噪)</description>
|
<description>媒体:录制、视频(水印、美颜、AI识别)、音频(降噪、混音、变声)</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc-mcu</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc-sfu</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.acgist</groupId>
|
<groupId>com.acgist</groupId>
|
||||||
<artifactId>taoyao-webrtc-mesh</artifactId>
|
<artifactId>taoyao-webrtc-mesh</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.acgist</groupId>
|
||||||
|
<artifactId>taoyao-webrtc-moon</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -377,13 +377,13 @@
|
|||||||
|
|
||||||
终端->服务端
|
终端->服务端
|
||||||
暂停发布、订阅(不关媒体流通道)
|
暂停发布、订阅(不关媒体流通道)
|
||||||
MCU/SFU模式有效
|
Moon模式有效
|
||||||
|
|
||||||
### 恢复信令(5005)
|
### 恢复信令(5005)
|
||||||
|
|
||||||
终端->服务端
|
终端->服务端
|
||||||
暂停发布、订阅(不关媒体流通道)
|
暂停发布、订阅(不关媒体流通道)
|
||||||
MCU/SFU模式有效
|
Moon模式有效
|
||||||
|
|
||||||
### 开启录像信令(5006)
|
### 开启录像信令(5006)
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,7 @@
|
|||||||
<description>WebRTC模块</description>
|
<description>WebRTC模块</description>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>taoyao-webrtc-sfu</module>
|
<module>taoyao-webrtc-moon</module>
|
||||||
<module>taoyao-webrtc-mcu</module>
|
|
||||||
<module>taoyao-webrtc-mesh</module>
|
<module>taoyao-webrtc-mesh</module>
|
||||||
<module>taoyao-webrtc-kurento</module>
|
<module>taoyao-webrtc-kurento</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
com.acgist.taoyao.webrtc.mcu.config.McuAutoConfiguration
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>taoyao-webrtc-mesh</name>
|
<name>taoyao-webrtc-mesh</name>
|
||||||
<description>WebRTC MESH架构实现</description>
|
<description>WebRTC Mesh架构实现</description>
|
||||||
|
|
||||||
<dependencies></dependencies>
|
<dependencies></dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>taoyao-webrtc-mcu</artifactId>
|
<artifactId>taoyao-webrtc-moon</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>taoyao-webrtc-mcu</name>
|
<name>taoyao-webrtc-moon</name>
|
||||||
<description>WebRTC MCU架构实现</description>
|
<description>WebRTC Moon架构实现</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.acgist.taoyao.webrtc.mcu.config;
|
package com.acgist.taoyao.webrtc.moon.config;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MCU自动配置
|
* MOON自动配置
|
||||||
*
|
*
|
||||||
* @author acgist
|
* @author acgist
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix = "taoyao.webrtc", name = "framework", havingValue = "MCU", matchIfMissing = false)
|
@ConditionalOnProperty(prefix = "taoyao.webrtc", name = "framework", havingValue = "MOON", matchIfMissing = false)
|
||||||
public class McuAutoConfiguration {
|
public class MoonAutoConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
com.acgist.taoyao.webrtc.moon.config.MoonAutoConfiguration
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>taoyao-webrtc-sfu</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>taoyao-webrtc-sfu</name>
|
|
||||||
<description>WebRTC SFU架构实现</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.acgist</groupId>
|
|
||||||
<artifactId>taoyao-webrtc-kurento</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.acgist.taoyao.webrtc.sfu.config;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SFU自动配置
|
|
||||||
*
|
|
||||||
* @author acgist
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConditionalOnProperty(prefix = "taoyao.webrtc", name = "framework", havingValue = "SFU", matchIfMissing = true)
|
|
||||||
public class SfuAutoConfiguration {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
com.acgist.taoyao.webrtc.sfu.config.SfuAutoConfiguration
|
|
||||||
Reference in New Issue
Block a user