diff --git a/README.md b/README.md index 78ab77b..c061862 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # 桃夭 -基于WebRTC实现信令服务,实现Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。
-项目提供WebRTC服务信令,终端已有H5示例,其他终端需要自己实现。 +桃夭是套`WebRTC`信令服务,综合`Mesh`、`MCU`和`SFU`三种媒体通信架构,支持直播会议两种场景。 ## 模块 @@ -16,9 +15,8 @@ |taoyao-server|服务|启动服务| |taoyao-meeting|会议|会议模式、广播模式、单人对讲| |taoyao-webrtc|WebRTC|WebRTC模块| -|taoyao-webrtc-sfu|SFU架构|SFU架构| -|taoyao-webrtc-mcu|MCU架构|MCU架构| -|taoyao-webrtc-mesh|MESH架构|MESH架构| +|taoyao-webrtc-mesh|Mesh架构|Mesh架构| +|taoyao-webrtc-moon|Moon架构|Moon架构| |taoyao-webrtc-kurento|kurento框架|WebRTC协议簇kurento实现| ## 模块关系 @@ -31,7 +29,7 @@ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | taoyao-media | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| taoyao-sfu / taoyao-mcu | | +| taoyao-moon(MCU/SFU) | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ taoyao-mesh + | taoyao-kurento | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -53,13 +51,17 @@ * ~~直播~~ * 会议:一对一、~~多对多~~ -* ~~媒体:录制、降噪、美颜等等~~ +* ~~媒体:降噪、变声、美颜录制、等等~~ * 可能需要自己搭建`coturn`服务实现`STUN`/`TURN`内网穿透功能 -### MCU/SFU +### Moon -终端推流到服务端,由服务端处理后分流。 +综合`MCU`/`SFU`两种架构,终端推流到服务端,由服务端处理后分流。 + +> 为什么叫`Moon`:因为这是古诗词中最美丽的意象 #### 注意事项 -* 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server) \ No newline at end of file +* 需要安装[KMS服务](./docs/Deploy.md#kmskurento-media-server) +* 提供混音、变声、美颜、录制等等媒体功能 +* 终端推送给服务端最高质量媒体,再由服务端根据订阅终端按配置分流。 diff --git a/docs/nginx/nginx.conf b/docs/nginx/nginx.conf new file mode 100644 index 0000000..eb519cf --- /dev/null +++ b/docs/nginx/nginx.conf @@ -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; + } + } + +} diff --git a/docs/sequence/Kurento.iuml b/docs/sequence/Kurento.iuml new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml index bd0b080..d254aa6 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ https://gitee.com/acgist/taoyao taoyao - 桃夭:基于WebRTC实现信令服务,实现Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。 + 桃夭:桃夭是套WebRTC信令服务,综合Mesh、MCU和SFU三种媒体通信架构,支持直播会议两种场景。 2022 @@ -143,21 +143,16 @@ taoyao-webrtc ${project.version} - - com.acgist - taoyao-webrtc-sfu - ${project.version} - - - com.acgist - taoyao-webrtc-mcu - ${project.version} - com.acgist taoyao-webrtc-mesh ${project.version} + + com.acgist + taoyao-webrtc-moon + ${project.version} + com.acgist taoyao-webrtc-kurento diff --git a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/BootAutoConfiguration.java b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/BootAutoConfiguration.java index 82b6a92..532722a 100644 --- a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/BootAutoConfiguration.java +++ b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/BootAutoConfiguration.java @@ -77,7 +77,7 @@ public class BootAutoConfiguration { @Value("${spring.application.name:taoyao}") private String name; - @Value("${taoyao.webrtc.framework:SFU}") + @Value("${taoyao.webrtc.framework:MOON}") private String framework; @Autowired diff --git a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java index 46d0126..9529999 100644 --- a/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java +++ b/taoyao-boot/src/main/java/com/acgist/taoyao/boot/config/WebrtcProperties.java @@ -24,18 +24,14 @@ public class WebrtcProperties { */ public enum Framework { - /** - * SFU架构 - */ - SFU, - /** - * MCU架构 - */ - MCU, /** * MESH架构 */ - MESH; + MESH, + /** + * MOON架构 + */ + MOON; } diff --git a/taoyao-media/pom.xml b/taoyao-media/pom.xml index 9a21e3e..9a6c4c3 100644 --- a/taoyao-media/pom.xml +++ b/taoyao-media/pom.xml @@ -14,21 +14,17 @@ jar taoyao-media - 媒体:录制、视频(美颜、AI识别)、音频(混音、变声、降噪) + 媒体:录制、视频(水印、美颜、AI识别)、音频(降噪、混音、变声) - - com.acgist - taoyao-webrtc-mcu - - - com.acgist - taoyao-webrtc-sfu - com.acgist taoyao-webrtc-mesh + + com.acgist + taoyao-webrtc-moon + \ No newline at end of file diff --git a/taoyao-signal/README.md b/taoyao-signal/README.md index b262493..c3ab2dd 100644 --- a/taoyao-signal/README.md +++ b/taoyao-signal/README.md @@ -377,13 +377,13 @@ 终端->服务端 暂停发布、订阅(不关媒体流通道) -MCU/SFU模式有效 +Moon模式有效 ### 恢复信令(5005) 终端->服务端 暂停发布、订阅(不关媒体流通道) -MCU/SFU模式有效 +Moon模式有效 ### 开启录像信令(5006) diff --git a/taoyao-webrtc/pom.xml b/taoyao-webrtc/pom.xml index 158766e..57ef6ed 100644 --- a/taoyao-webrtc/pom.xml +++ b/taoyao-webrtc/pom.xml @@ -17,8 +17,7 @@ WebRTC模块 - taoyao-webrtc-sfu - taoyao-webrtc-mcu + taoyao-webrtc-moon taoyao-webrtc-mesh taoyao-webrtc-kurento diff --git a/taoyao-webrtc/taoyao-webrtc-mcu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/taoyao-webrtc/taoyao-webrtc-mcu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 4e6a786..0000000 --- a/taoyao-webrtc/taoyao-webrtc-mcu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.acgist.taoyao.webrtc.mcu.config.McuAutoConfiguration \ No newline at end of file diff --git a/taoyao-webrtc/taoyao-webrtc-mesh/pom.xml b/taoyao-webrtc/taoyao-webrtc-mesh/pom.xml index b38ca4d..9f1d49e 100644 --- a/taoyao-webrtc/taoyao-webrtc-mesh/pom.xml +++ b/taoyao-webrtc/taoyao-webrtc-mesh/pom.xml @@ -14,7 +14,7 @@ jar taoyao-webrtc-mesh - WebRTC MESH架构实现 + WebRTC Mesh架构实现 diff --git a/taoyao-webrtc/taoyao-webrtc-mcu/pom.xml b/taoyao-webrtc/taoyao-webrtc-moon/pom.xml similarity index 82% rename from taoyao-webrtc/taoyao-webrtc-mcu/pom.xml rename to taoyao-webrtc/taoyao-webrtc-moon/pom.xml index ff5d84f..83161e4 100644 --- a/taoyao-webrtc/taoyao-webrtc-mcu/pom.xml +++ b/taoyao-webrtc/taoyao-webrtc-moon/pom.xml @@ -10,11 +10,11 @@ 1.0.0 - taoyao-webrtc-mcu + taoyao-webrtc-moon jar - taoyao-webrtc-mcu - WebRTC MCU架构实现 + taoyao-webrtc-moon + WebRTC Moon架构实现 diff --git a/taoyao-webrtc/taoyao-webrtc-mcu/src/main/java/com/acgist/taoyao/webrtc/mcu/config/McuAutoConfiguration.java b/taoyao-webrtc/taoyao-webrtc-moon/src/main/java/com/acgist/taoyao/webrtc/moon/config/MoonAutoConfiguration.java similarity index 62% rename from taoyao-webrtc/taoyao-webrtc-mcu/src/main/java/com/acgist/taoyao/webrtc/mcu/config/McuAutoConfiguration.java rename to taoyao-webrtc/taoyao-webrtc-moon/src/main/java/com/acgist/taoyao/webrtc/moon/config/MoonAutoConfiguration.java index fde8907..6592c89 100644 --- a/taoyao-webrtc/taoyao-webrtc-mcu/src/main/java/com/acgist/taoyao/webrtc/mcu/config/McuAutoConfiguration.java +++ b/taoyao-webrtc/taoyao-webrtc-moon/src/main/java/com/acgist/taoyao/webrtc/moon/config/MoonAutoConfiguration.java @@ -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.context.annotation.Configuration; /** - * MCU自动配置 + * MOON自动配置 * * @author acgist */ @Configuration -@ConditionalOnProperty(prefix = "taoyao.webrtc", name = "framework", havingValue = "MCU", matchIfMissing = false) -public class McuAutoConfiguration { +@ConditionalOnProperty(prefix = "taoyao.webrtc", name = "framework", havingValue = "MOON", matchIfMissing = false) +public class MoonAutoConfiguration { } diff --git a/taoyao-webrtc/taoyao-webrtc-moon/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/taoyao-webrtc/taoyao-webrtc-moon/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..9292344 --- /dev/null +++ b/taoyao-webrtc/taoyao-webrtc-moon/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.acgist.taoyao.webrtc.moon.config.MoonAutoConfiguration \ No newline at end of file diff --git a/taoyao-webrtc/taoyao-webrtc-sfu/pom.xml b/taoyao-webrtc/taoyao-webrtc-sfu/pom.xml deleted file mode 100644 index 06846e8..0000000 --- a/taoyao-webrtc/taoyao-webrtc-sfu/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - 4.0.0 - - - com.acgist - taoyao-webrtc - 1.0.0 - - - taoyao-webrtc-sfu - jar - - taoyao-webrtc-sfu - WebRTC SFU架构实现 - - - - com.acgist - taoyao-webrtc-kurento - - - - \ No newline at end of file diff --git a/taoyao-webrtc/taoyao-webrtc-sfu/src/main/java/com/acgist/taoyao/webrtc/sfu/config/SfuAutoConfiguration.java b/taoyao-webrtc/taoyao-webrtc-sfu/src/main/java/com/acgist/taoyao/webrtc/sfu/config/SfuAutoConfiguration.java deleted file mode 100644 index 0332067..0000000 --- a/taoyao-webrtc/taoyao-webrtc-sfu/src/main/java/com/acgist/taoyao/webrtc/sfu/config/SfuAutoConfiguration.java +++ /dev/null @@ -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 { - -} diff --git a/taoyao-webrtc/taoyao-webrtc-sfu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/taoyao-webrtc/taoyao-webrtc-sfu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index a62759a..0000000 --- a/taoyao-webrtc/taoyao-webrtc-sfu/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.acgist.taoyao.webrtc.sfu.config.SfuAutoConfiguration \ No newline at end of file