[+] 分辨率调整

This commit is contained in:
acgist
2023-02-14 20:42:02 +08:00
parent 778b933000
commit 948b628937
14 changed files with 266 additions and 128 deletions

View File

@@ -31,26 +31,31 @@ public class MediaProperties {
*/
@Schema(title = "视频配置", description = "视频配置")
private MediaVideoProperties video;
/**
* 4K视频
*/
@Schema(title = "4K视频", description = "4K视频")
private MediaVideoProperties udVideo;
/**
* 2K视频
*/
@Schema(title = "2K视频", description = "2K视频")
private MediaVideoProperties qdVideo;
/**
* 超清视频
*/
@Schema(title = "超清视频", description = "超清视频")
private MediaVideoProperties mostVideo;
private MediaVideoProperties fdVideo;
/**
* 高清视频
*/
@Schema(title = "高清视频", description = "高清视频")
private MediaVideoProperties highVideo;
private MediaVideoProperties hdVideo;
/**
* 标清视频
*/
@Schema(title = "标清视频", description = "标清视频")
private MediaVideoProperties normVideo;
/**
* 流畅视频
*/
@Schema(title = "流畅视频", description = "流畅视频")
private MediaVideoProperties flowVideo;
private MediaVideoProperties sdVideo;
/**
* 媒体服务配置
*/

View File

@@ -58,7 +58,7 @@ public class MediaVideoProperties {
/**
* 分辨率(画面大小)
*/
@Schema(title = "分辨率", description = "分辨率影响画面大小", example = "1920*1080|1280*720|480*360")
@Schema(title = "分辨率", description = "分辨率影响画面大小", example = "1920*1080|1280*720")
private String resolution;
/**
* 宽度

View File

@@ -21,11 +21,11 @@ public class WebrtcProperties {
* STUN服务器
*/
@Schema(title = "STUN服务器", description = "STUN服务器")
private String[] stun;
private WebrtcStunProperties[] stun;
/**
* TURN服务器
*/
@Schema(title = "TURN服务器", description = "TURN服务器")
private String[] turn;
private WebrtcTurnProperties[] turn;
}

View File

@@ -0,0 +1,36 @@
package com.acgist.taoyao.boot.property;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* WebRTC STUN配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "WebRTC STUN配置", description = "WebRTC STUN配置")
public class WebrtcStunProperties {
/**
* 主机
*/
@Schema(title = "主机", description = "主机")
protected String host;
/**
* 端口
*/
@Schema(title = "端口", description = "端口")
protected Integer port;
/**
* @return 完整地址
*/
@Schema(title = "完整地址", description = "完整地址")
public String getAddress() {
return "stun://" + this.host + ":" + this.port;
}
}

View File

@@ -0,0 +1,36 @@
package com.acgist.taoyao.boot.property;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* WebRTC TURN配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "WebRTC TURN配置", description = "WebRTC TURN配置")
public class WebrtcTurnProperties extends WebrtcStunProperties {
/**
* 帐号
*/
@Schema(title = "帐号", description = "帐号")
private String username;
/**
* 密码
*/
@Schema(title = "密码", description = "密码")
private String password;
/**
* @return 完整地址
*/
@Schema(title = "完整地址", description = "完整地址")
public String getAddress() {
return "turn://" + this.host + ":" + this.port;
}
}

View File

@@ -0,0 +1,91 @@
package com.acgist.taoyao.boot.utils;
import java.net.http.HttpClient;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.X509TrustManager;
import lombok.extern.slf4j.Slf4j;
/**
* HTTP工具
*
* @author acgist
*/
@Slf4j
public final class HTTPUtils {
private HTTPUtils() {
}
/**
* @return HTTPClient
*/
public static final HttpClient newClient() {
return HttpClient
.newBuilder()
.sslContext(buildSSLContext())
.build();
}
/**
* SSLContext
*
* @return {@link SSLContext}
*/
private static final SSLContext buildSSLContext() {
try {
// SSL协议SSL、SSLv2、SSLv3、TLS、TLSv1、TLSv1.1、TLSv1.2、TLSv1.3
final SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, new X509TrustManager[] { TaoyaoTrustManager.INSTANCE }, new SecureRandom());
return sslContext;
} catch (KeyManagementException | NoSuchAlgorithmException e) {
log.error("新建SSLContext异常", e);
}
try {
return SSLContext.getDefault();
} catch (NoSuchAlgorithmException e) {
log.error("新建SSLContext异常", e);
}
return null;
}
/**
* 证书验证
*
* @author acgist
*/
public static class TaoyaoTrustManager implements X509TrustManager {
private static final TaoyaoTrustManager INSTANCE = new TaoyaoTrustManager();
private TaoyaoTrustManager() {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if(chain == null) {
throw new CertificateException("证书验证失败");
}
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if(chain == null) {
throw new CertificateException("证书验证失败");
}
}
}
}