diff --git a/README.md b/README.md index 27656e9..7b3d0d1 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,6 @@ Android还在学习之中... * 优化JS错误回调 -> platform::error * 反复测试推流拉流、拉人踢人、音频视频控制 * 24小时不关闭媒体/一秒一次推拉流十分钟测试/三十秒推拉流一小时测试 + +* AI、美颜、水印、滤镜 +* 混音、降噪、回音消除、声音特效 \ No newline at end of file diff --git a/taoyao-client-android/taoyao/.gitignore b/taoyao-client-android/taoyao/.gitignore index f022b39..771339a 100644 --- a/taoyao-client-android/taoyao/.gitignore +++ b/taoyao-client-android/taoyao/.gitignore @@ -6,4 +6,4 @@ local.properties **/build -mediasoup/deps \ No newline at end of file +media/deps \ No newline at end of file diff --git a/taoyao-client-android/taoyao/boot/build.gradle b/taoyao-client-android/taoyao/boot/build.gradle index 02e1874..5eea37d 100644 --- a/taoyao-client-android/taoyao/boot/build.gradle +++ b/taoyao-client-android/taoyao/boot/build.gradle @@ -11,7 +11,6 @@ android { versionCode 100 versionName "1.0.0" consumerProguardFiles "consumer-rules.pro" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -29,6 +28,4 @@ dependencies { implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/Message.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/Message.java index 50c61ac..f0cedab 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/Message.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/Message.java @@ -11,214 +11,206 @@ import com.fasterxml.jackson.annotation.JsonIncludeProperties; /** * 消息 * 接口、信令、媒体信令通用消息模型 - * + * * @author acgist */ -@JsonIncludeProperties(value = { "code", "message", "header", "body" }) +@JsonIncludeProperties(value = {"code", "message", "header", "body"}) public class Message implements Cloneable, Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 状态编码 - */ - private String code; - /** - * 状态描述 - */ - private String message; - /** - * 消息头部 - */ - private Header header; - /** - * 消息主体 - */ - private Object body; - - /** - * @param code 状态编码 - */ - public void setCode(String code) { - this.code = code; - } - - /** - * @param code 状态编码 - */ - public void setCode(MessageCode code) { - this.setCode(code, null); - } - - /** - * @param code 状态编码 - * @param message 状态描述 - * - * @return this - */ - public Message setCode(MessageCode code, String message) { - this.code = code.getCode(); - this.message = message == null || message.isEmpty() ? code.getMessage() : message; - return this; - } + /** + * 状态编码 + */ + private String code; + /** + * 状态描述 + */ + private String message; + /** + * 消息头部 + */ + private Header header; + /** + * 消息主体 + */ + private Object body; - /** - * @return 成功消息 - */ - public static final Message success() { - return success(null); - } + /** + * @param code 状态编码 + */ + public void setCode(String code) { + this.code = code; + } - /** - * @param body 消息主体 - * - * @return 成功消息 - */ - public static final Message success(Object body) { - final Message message = new Message(); - message.setCode(MessageCode.CODE_0000, null); - message.body = body; - return message; - } + /** + * @param code 状态编码 + */ + public void setCode(MessageCode code) { + this.setCode(code, null); + } - /** - * @return 失败消息 - */ - public static final Message fail() { - return fail(null, null, null); - } + /** + * @param code 状态编码 + * @param message 状态描述 + * @return this + */ + public Message setCode(MessageCode code, String message) { + this.code = code.getCode(); + this.message = message == null || message.isEmpty() ? code.getMessage() : message; + return this; + } - /** - * @param code 状态编码 - * - * @return 失败消息 - */ - public static final Message fail(MessageCode code) { - return fail(code, null, null); - } + /** + * @return 成功消息 + */ + public static final Message success() { + return success(null); + } - /** - * @param code 状态编码 - * @param body 消息主体 - * - * @return 失败消息 - */ - public static final Message fail(MessageCode code, Object body) { - return fail(code, null, body); - } - - /** - * @param message 状态描述 - * - * @return 失败消息 - */ - public static final Message fail(String message) { - return fail(null, message, null); - } - - /** - * @param message 状态描述 - * @param body 消息主体 - * - * @return 失败消息 - */ - public static final Message fail(String message, Object body) { - return fail(null, message, body); - } - - /** - * @param code 状态编码 - * @param message 状态描述 - * - * @return 失败消息 - */ - public static final Message fail(MessageCode code, String message) { - return fail(code, message, null); - } + /** + * @param body 消息主体 + * @return 成功消息 + */ + public static final Message success(Object body) { + final Message message = new Message(); + message.setCode(MessageCode.CODE_0000, null); + message.body = body; + return message; + } - /** - * @param code 状态编码 - * @param message 状态描述 - * @param body 消息主体 - * - * @return 失败消息 - */ - public static final Message fail(MessageCode code, String message, Object body) { - final Message failMessage = new Message(); - failMessage.setCode(code == null ? MessageCode.CODE_9999 : code, message); - failMessage.body = body; - return failMessage; - } + /** + * @return 失败消息 + */ + public static final Message fail() { + return fail(null, null, null); + } - @Override - public Message clone() { - return new Message(this.code, this.message, this.header.clone(), this.body); - } - - /** - * 克隆消息排除消息主体 - * - * @return 克隆消息 - */ - public Message cloneWithoutBody() { - return new Message(this.code, this.message, this.header.clone(), null); - } - - /** - * @return Map消息主体 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + /** + * @param code 状态编码 + * @return 失败消息 + */ + public static final Message fail(MessageCode code) { + return fail(code, null, null); + } + + /** + * @param code 状态编码 + * @param body 消息主体 + * @return 失败消息 + */ + public static final Message fail(MessageCode code, Object body) { + return fail(code, null, body); + } + + /** + * @param message 状态描述 + * @return 失败消息 + */ + public static final Message fail(String message) { + return fail(null, message, null); + } + + /** + * @param message 状态描述 + * @param body 消息主体 + * @return 失败消息 + */ + public static final Message fail(String message, Object body) { + return fail(null, message, body); + } + + /** + * @param code 状态编码 + * @param message 状态描述 + * @return 失败消息 + */ + public static final Message fail(MessageCode code, String message) { + return fail(code, message, null); + } + + /** + * @param code 状态编码 + * @param message 状态描述 + * @param body 消息主体 + * @return 失败消息 + */ + public static final Message fail(MessageCode code, String message, Object body) { + final Message failMessage = new Message(); + failMessage.setCode(code == null ? MessageCode.CODE_9999 : code, message); + failMessage.body = body; + return failMessage; + } + + @Override + public Message clone() { + return new Message(this.code, this.message, this.header.clone(), this.body); + } + + /** + * 克隆消息排除消息主体 + * + * @return 克隆消息 + */ + public Message cloneWithoutBody() { + return new Message(this.code, this.message, this.header.clone(), null); + } + + /** + * @return Map消息主体 + */ + @SuppressWarnings({"rawtypes", "unchecked"}) public Map body() { - if(this.body instanceof Map) { + if (this.body instanceof Map) { return (Map) this.body; - } else if(this.body == null) { + } else if (this.body == null) { return new HashMap<>(); } else { throw MessageCodeException.of("信令主体类型错误:" + this.body); } - } - - @Override - public String toString() { - return JSONUtils.toJSON(this); - } + } - public Message() { - } + @Override + public String toString() { + return JSONUtils.toJSON(this); + } - public Message(String code, String message, Header header, Object body) { - this.code = code; - this.message = message; - this.header = header; - this.body = body; - } + public Message() { + } - public String getCode() { - return code; - } + public Message(String code, String message, Header header, Object body) { + this.code = code; + this.message = message; + this.header = header; + this.body = body; + } - public String getMessage() { - return message; - } + public String getCode() { + return code; + } - public void setMessage(String message) { - this.message = message; - } + public String getMessage() { + return message; + } - public Header getHeader() { - return header; - } + public void setMessage(String message) { + this.message = message; + } - public void setHeader(Header header) { - this.header = header; - } + public Header getHeader() { + return header; + } - public Object getBody() { - return body; - } + public void setHeader(Header header) { + this.header = header; + } - public void setBody(Object body) { - this.body = body; - } + public Object getBody() { + return body; + } + + public void setBody(Object body) { + this.body = body; + } } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCode.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCode.java index 6cc859b..066f355 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCode.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCode.java @@ -2,98 +2,96 @@ package com.acgist.taoyao.boot.model; /** * 状态编码 - * + *

* 1xxx = 前置错误 * 2xxx = 内部错误 * 3xxx = 请求错误 * 9999 = 未知错误 - * + * * @author acgist */ public enum MessageCode { - - // 成功 - CODE_0000("0000", 200, "成功"), - // 1xxx - CODE_1000("1000", 404, "未知接口"), - CODE_1001("1001", 400, "上次请求没有完成"), - CODE_1002("1002", 400, "数据格式错误"), - CODE_1003("1003", 400, "验签失败"), - // 2xxx - CODE_2000("2000", 500, "服务错误"), - CODE_2001("2001", 504, "服务超时"), - // 3xxx - CODE_3400("3400", 400, "请求错误"), - CODE_3401("3401", 401, "没有授权"), - CODE_3403("3403", 403, "请求拒绝"), - CODE_3404("3404", 404, "资源失效"), - CODE_3405("3405", 405, "请求方法错误"), - CODE_3406("3406", 406, "请求不可接受"), - CODE_3415("3415", 415, "请求资源类型错误"), - CODE_3500("3500", 500, "系统异常"), - CODE_3502("3502", 502, "服务无效"), - CODE_3503("3503", 503, "服务正在维护"), - CODE_3504("3504", 504, "服务超时"), - // 9999 - CODE_9999("9999", 500, "未知错误"); - - /** - * HTTP状态编码前缀 - */ - private static final String HTTP_STATUS = "3"; - - /** - * 状态编码 - */ - private final String code; - /** - * 状态数值 - */ - private final Integer status; - /** - * 状态描述 - */ - private final String message; - private MessageCode(String code, Integer status, String message) { - this.code = code; - this.status = status; - this.message = message; - } + // 成功 + CODE_0000("0000", 200, "成功"), + // 1xxx + CODE_1000("1000", 404, "未知接口"), + CODE_1001("1001", 400, "上次请求没有完成"), + CODE_1002("1002", 400, "数据格式错误"), + CODE_1003("1003", 400, "验签失败"), + // 2xxx + CODE_2000("2000", 500, "服务错误"), + CODE_2001("2001", 504, "服务超时"), + // 3xxx + CODE_3400("3400", 400, "请求错误"), + CODE_3401("3401", 401, "没有授权"), + CODE_3403("3403", 403, "请求拒绝"), + CODE_3404("3404", 404, "资源失效"), + CODE_3405("3405", 405, "请求方法错误"), + CODE_3406("3406", 406, "请求不可接受"), + CODE_3415("3415", 415, "请求资源类型错误"), + CODE_3500("3500", 500, "系统异常"), + CODE_3502("3502", 502, "服务无效"), + CODE_3503("3503", 503, "服务正在维护"), + CODE_3504("3504", 504, "服务超时"), + // 9999 + CODE_9999("9999", 500, "未知错误"); - /** - * @param code 状态编码 - * - * @return 状态编码 - */ - public static final MessageCode of(String code) { - final MessageCode[] values = MessageCode.values(); - for (MessageCode value : values) { - if (value.code.equals(code)) { - return value; - } - } - return CODE_9999; - } + /** + * HTTP状态编码前缀 + */ + private static final String HTTP_STATUS = "3"; - /** - * @param status HTTP Status - * - * @return 状态编码 - */ - public static final MessageCode of(Integer status) { - return of(HTTP_STATUS + status); - } + /** + * 状态编码 + */ + private final String code; + /** + * 状态数值 + */ + private final Integer status; + /** + * 状态描述 + */ + private final String message; - public String getCode() { - return code; - } + private MessageCode(String code, Integer status, String message) { + this.code = code; + this.status = status; + this.message = message; + } - public Integer getStatus() { - return status; - } + /** + * @param code 状态编码 + * @return 状态编码 + */ + public static final MessageCode of(String code) { + final MessageCode[] values = MessageCode.values(); + for (MessageCode value : values) { + if (value.code.equals(code)) { + return value; + } + } + return CODE_9999; + } - public String getMessage() { - return message; - } + /** + * @param status HTTP Status + * @return 状态编码 + */ + public static final MessageCode of(Integer status) { + return of(HTTP_STATUS + status); + } + + public String getCode() { + return code; + } + + public Integer getStatus() { + return status; + } + + public String getMessage() { + return message; + } } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCodeException.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCodeException.java index f04e866..d2299f3 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCodeException.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/model/MessageCodeException.java @@ -4,72 +4,68 @@ import java.util.Objects; /** * 状态编码异常 - * + * * @author acgist */ public class MessageCodeException extends RuntimeException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 状态编码 - */ - private final MessageCode code; + /** + * 状态编码 + */ + private final MessageCode code; - /** - * @param message 异常消息 - * - * @return 状态编码异常 - */ - public static final MessageCodeException of(String message) { - return of(null, null, message); - } - - /** - * @param t 异常 - * @param message 异常消息 - * - * @return 状态编码异常 - */ - public static final MessageCodeException of(Throwable t, String message) { - return of(t, null, message); - } - - /** - * @param code 状态编码 - * @param message 异常消息 - * - * @return 状态编码异常 - */ - public static final MessageCodeException of(MessageCode code, String message) { - return of(null, code, message); - } - - /** - * @param t 异常 - * @param code 状态编码 - * @param message 异常消息 - * - * @return 状态编码异常 - */ - public static final MessageCodeException of(Throwable t, MessageCode code, String message) { - if(code == null) { - code = MessageCode.CODE_9999; - } - if(message == null || message.isEmpty()) { - message = Objects.isNull(t) ? code.getMessage() : t.getMessage(); - } - return new MessageCodeException(t, code, message); - } + /** + * @param message 异常消息 + * @return 状态编码异常 + */ + public static final MessageCodeException of(String message) { + return of(null, null, message); + } - /** - * @param t 异常 - * @param code 状态编码 - * @param message 异常消息 - */ - public MessageCodeException(Throwable t, MessageCode code, String message) { - super(message, t); - this.code = code; - } + /** + * @param t 异常 + * @param message 异常消息 + * @return 状态编码异常 + */ + public static final MessageCodeException of(Throwable t, String message) { + return of(t, null, message); + } + + /** + * @param code 状态编码 + * @param message 异常消息 + * @return 状态编码异常 + */ + public static final MessageCodeException of(MessageCode code, String message) { + return of(null, code, message); + } + + /** + * @param t 异常 + * @param code 状态编码 + * @param message 异常消息 + * @return 状态编码异常 + */ + public static final MessageCodeException of(Throwable t, MessageCode code, String message) { + if (code == null) { + code = MessageCode.CODE_9999; + } + if (message == null || message.isEmpty()) { + message = Objects.isNull(t) ? code.getMessage() : t.getMessage(); + } + return new MessageCodeException(t, code, message); + } + + /** + * @param t 异常 + * @param code 状态编码 + * @param message 异常消息 + */ + public MessageCodeException(Throwable t, MessageCode code, String message) { + super(message, t); + this.code = code; + } } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/CloseableUtils.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/CloseableUtils.java index a0877d2..0e0fcbf 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/CloseableUtils.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/CloseableUtils.java @@ -4,42 +4,42 @@ import java.io.Closeable; /** * 关闭资源工具 - * + * * @author acgist */ public final class CloseableUtils { - private CloseableUtils() { - } - - /** - * 关闭资源 - * - * @param closeable 资源 - */ - public static final void close(Closeable closeable) { - try { - if(closeable != null) { - closeable.close(); - } - } catch (Exception e) { - // TODO:日志 - } - } - - /** - * 关闭资源 - * - * @param closeable 资源 - */ - public static final void close(AutoCloseable closeable) { - try { - if(closeable != null) { - closeable.close(); - } - } catch (Exception e) { - // TODO:日志 - } - } - + private CloseableUtils() { + } + + /** + * 关闭资源 + * + * @param closeable 资源 + */ + public static final void close(Closeable closeable) { + try { + if (closeable != null) { + closeable.close(); + } + } catch (Exception e) { + // TODO:日志 + } + } + + /** + * 关闭资源 + * + * @param closeable 资源 + */ + public static final void close(AutoCloseable closeable) { + try { + if (closeable != null) { + closeable.close(); + } + } catch (Exception e) { + // TODO:日志 + } + } + } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/DateUtils.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/DateUtils.java index 1322955..77821dc 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/DateUtils.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/DateUtils.java @@ -10,17 +10,17 @@ import java.util.Objects; /** * 日期工具 - * + * * @author acgist */ public final class DateUtils { - - private DateUtils() { - } + + private DateUtils() { + } /** * 日期 - * + * * @author acgist */ public static enum DateStyle { @@ -44,60 +44,61 @@ public final class DateUtils { this.dateTimeFormatter = DateTimeFormatter.ofPattern(format); } - public String getFormat() { - return this.format; - } + public String getFormat() { + return this.format; + } - public DateTimeFormatter getDateTimeFormatter() { - return this.dateTimeFormatter; - } - } - - /** - * 时间 - * - * @author acgist - */ - public static enum TimeStyle { + public DateTimeFormatter getDateTimeFormatter() { + return this.dateTimeFormatter; + } + } - HH24("HH"), - HH24MM("HHmm"), - HH24_MM("HH:mm"), - HH24MMSS("HHmmss"), - HH24_MM_SS("HH:mm:ss"), - HH24MMSSSSS("HHmmssSSS"), - HH24_MM_SS_SSS("HH:mm:ss.SSS"); + /** + * 时间 + * + * @author acgist + */ + public static enum TimeStyle { - /** - * 格式 - */ - private final String format; - /** - * 格式工具 - */ - private final DateTimeFormatter dateTimeFormatter; + HH24("HH"), + HH24MM("HHmm"), + HH24_MM("HH:mm"), + HH24MMSS("HHmmss"), + HH24_MM_SS("HH:mm:ss"), + HH24MMSSSSS("HHmmssSSS"), + HH24_MM_SS_SSS("HH:mm:ss.SSS"); - private TimeStyle(String format) { - this.format = format; - this.dateTimeFormatter = DateTimeFormatter.ofPattern(format); - } - public String getFormat() { - return this.format; - } + /** + * 格式 + */ + private final String format; + /** + * 格式工具 + */ + private final DateTimeFormatter dateTimeFormatter; - public DateTimeFormatter getDateTimeFormatter() { - return this.dateTimeFormatter; - } + private TimeStyle(String format) { + this.format = format; + this.dateTimeFormatter = DateTimeFormatter.ofPattern(format); + } + + public String getFormat() { + return this.format; + } + + public DateTimeFormatter getDateTimeFormatter() { + return this.dateTimeFormatter; + } + + } - } - /** * 日期时间 - * + * * @author acgist */ public static enum DateTimeStyle { - + // YYYY YYYYMMDD_HH24_MM("yyyyMMdd HH:mm"), YYYY_MM_DD_HH24_MM("yyyy-MM-dd HH:mm"), @@ -140,119 +141,111 @@ public final class DateUtils { this.format = format; this.dateTimeFormatter = DateTimeFormatter.ofPattern(format); } - public String getFormat() { - return this.format; - } - public DateTimeFormatter getDateTimeFormatter() { - return this.dateTimeFormatter; - } + public String getFormat() { + return this.format; + } + + public DateTimeFormatter getDateTimeFormatter() { + return this.dateTimeFormatter; + } } - /** - * 生成时间戳 - * - * @return 时间戳 - * - * @see #buildTime(LocalDateTime) - */ - public static final String buildTime() { - return buildTime(LocalDateTime.now()); - } + /** + * 生成时间戳 + * + * @return 时间戳 + * @see #buildTime(LocalDateTime) + */ + public static final String buildTime() { + return buildTime(LocalDateTime.now()); + } - /** - * 生成时间戳 - * - * @param localDateTime 日期时间 - * - * @return 时间戳 - */ - public static final String buildTime(LocalDateTime localDateTime) { - if (Objects.isNull(localDateTime)) { - return buildTime(); - } - return DateTimeStyle.YYYYMMDDHH24MMSS.getDateTimeFormatter().format(localDateTime); - } - - /** - * 日期转化 - * - * @param date Date - * - * @return LocalDate - */ - public static final LocalDate toLocalDate(Date date) { - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); - } - - /** - * 日期转化 - * - * @param date Date - * - * @return LocalTime - */ - public static final LocalTime toLocalTime(Date date) { - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalTime(); - } + /** + * 生成时间戳 + * + * @param localDateTime 日期时间 + * @return 时间戳 + */ + public static final String buildTime(LocalDateTime localDateTime) { + if (Objects.isNull(localDateTime)) { + return buildTime(); + } + return DateTimeStyle.YYYYMMDDHH24MMSS.getDateTimeFormatter().format(localDateTime); + } - /** - * 日期转化 - * - * @param date Date - * - * @return LocalDateTime - */ - public static final LocalDateTime toLocalDateTime(Date date) { - return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - } + /** + * 日期转化 + * + * @param date Date + * @return LocalDate + */ + public static final LocalDate toLocalDate(Date date) { + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + } - /** - * 转换毫秒 - * - * @param localDateTime LocalDateTime - * - * @return 毫秒 - */ - public static final long toMilli(LocalDateTime localDateTime) { - return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - } - - /** - * 格式化日期 - * - * @param localDate LocalDate - * @param format 格式 - * - * @return 日期字符串 - */ - public static String format(LocalDate localDate, DateStyle format) { - return localDate != null && format != null ? format.getDateTimeFormatter().format(localDate) : null; - } - - /** - * 格式化时间 - * - * @param localTime LocalTime - * @param format 格式 - * - * @return 时间字符串 - */ - public static String format(LocalTime localTime, TimeStyle format) { - return localTime != null && format != null ? format.getDateTimeFormatter().format(localTime) : null; - } - - /** - * 格式化日期时间 - * - * @param localDateTime LocalDateTime - * @param format 格式 - * - * @return 日期时间字符串 - */ - public static String format(LocalDateTime localDateTime, DateTimeStyle format) { - return localDateTime != null && format != null ? format.getDateTimeFormatter().format(localDateTime) : null; - } + /** + * 日期转化 + * + * @param date Date + * @return LocalTime + */ + public static final LocalTime toLocalTime(Date date) { + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalTime(); + } + + /** + * 日期转化 + * + * @param date Date + * @return LocalDateTime + */ + public static final LocalDateTime toLocalDateTime(Date date) { + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + } + + /** + * 转换毫秒 + * + * @param localDateTime LocalDateTime + * @return 毫秒 + */ + public static final long toMilli(LocalDateTime localDateTime) { + return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + } + + /** + * 格式化日期 + * + * @param localDate LocalDate + * @param format 格式 + * @return 日期字符串 + */ + public static String format(LocalDate localDate, DateStyle format) { + return localDate != null && format != null ? format.getDateTimeFormatter().format(localDate) : null; + } + + /** + * 格式化时间 + * + * @param localTime LocalTime + * @param format 格式 + * @return 时间字符串 + */ + public static String format(LocalTime localTime, TimeStyle format) { + return localTime != null && format != null ? format.getDateTimeFormatter().format(localTime) : null; + } + + /** + * 格式化日期时间 + * + * @param localDateTime LocalDateTime + * @param format 格式 + * @return 日期时间字符串 + */ + public static String format(LocalDateTime localDateTime, DateTimeStyle format) { + return localDateTime != null && format != null ? format.getDateTimeFormatter().format(localDateTime) : null; + } } diff --git a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/JSONUtils.java b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/JSONUtils.java index 519d94a..5dd910f 100644 --- a/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/JSONUtils.java +++ b/taoyao-client-android/taoyao/boot/src/main/java/com/acgist/taoyao/boot/utils/JSONUtils.java @@ -25,201 +25,188 @@ import java.util.*; /** * JSON工具 - * + * * @author acgist */ public final class JSONUtils { - private JSONUtils() { - } + private JSONUtils() { + } - /** - * Mapper(线程安全) - */ - private static final ObjectMapper MAPPER = buildMapper(); - - /** - * Java转JSON - * - * @param object Java - * - * @return JSON - */ - public static final String toJSON(Object object) { - if (Objects.isNull(object)) { - return null; - } - try { - return MAPPER.writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new RuntimeException("Java转JSON失败:" + object, e); - } - } - - /** - * JSON转Java - * - * @param Java类型 - * - * @param json JSON - * - * @return Java - */ - public static final T toJava(String json) { - if (Objects.isNull(json)) { - return null; - } - try { - return MAPPER.readValue(json, new TypeReference() { - }); - } catch (IOException e) { - throw new RuntimeException("JSON转Java失败:" + json, e); - } - } + /** + * Mapper(线程安全) + */ + private static final ObjectMapper MAPPER = buildMapper(); - /** - * JSON转Java - * - * @param Java类型 - * - * @param json JSON - * @param clazz Java类型 - * - * @return Java - */ - public static final T toJava(String json, Class clazz) { - if (Objects.isNull(json) || Objects.isNull(clazz)) { - return null; - } - try { - return MAPPER.readValue(json, clazz); - } catch (IOException e) { - throw new RuntimeException("JSON转Java失败:" + json, e); - } - } - - /** - * JSON转Java - * - * @param Java类型 - * - * @param json JSON - * @param type Java类型 - * - * @return Java - */ - public static final T toJava(String json, TypeReference type) { - if (Objects.isNull(json) || Objects.isNull(type)) { - return null; - } - try { - return MAPPER.readValue(json, type); - } catch (IOException e) { - throw new RuntimeException("JSON转Java失败:" + json, e); - } - } + /** + * Java转JSON + * + * @param object Java + * @return JSON + */ + public static final String toJSON(Object object) { + if (Objects.isNull(object)) { + return null; + } + try { + return MAPPER.writeValueAsString(object); + } catch (JsonProcessingException e) { + throw new RuntimeException("Java转JSON失败:" + object, e); + } + } - /** - * JSON转Map - * - * @param K类型 - * @param V类型 - * - * @param json JSON - * - * @return Map - */ - public static final Map toMap(String json) { - if (Objects.isNull(json)) { - return new HashMap<>(); - } - try { - return MAPPER.readValue(json, new TypeReference>() { - }); - } catch (IOException e) { - throw new RuntimeException("JSON转Map失败:" + json, e); - } - } + /** + * JSON转Java + * + * @param Java类型 + * @param json JSON + * @return Java + */ + public static final T toJava(String json) { + if (Objects.isNull(json)) { + return null; + } + try { + return MAPPER.readValue(json, new TypeReference() { + }); + } catch (IOException e) { + throw new RuntimeException("JSON转Java失败:" + json, e); + } + } - /** - * JSON转List - * - * @param 元素类型 - * - * @param json JSON - * - * @return List - */ - public static final List toList(String json) { - if (Objects.isNull(json)) { - return new ArrayList<>(); - } - try { - return MAPPER.readValue(json, new TypeReference>() { - }); - } catch (IOException e) { - throw new RuntimeException("JSON转List失败:" + json, e); - } - } - - /** - * JSON转List - * - * @param 元素类型 - * - * @param json JSON - * @param clazz 类型 - * - * @return List - */ - public static final List toList(String json, Class clazz) { - if (Objects.isNull(json)) { - return new ArrayList<>(); - } - try { - return MAPPER.readValue(json, new TypeReference>() { - }); - } catch (IOException e) { - throw new RuntimeException("JSON转List失败:" + json, e); - } - } - - /** - * @return Mapper - */ - public static final ObjectMapper buildMapper() { - final ObjectMapper mapper = new ObjectMapper(); - return mapper - .setTimeZone(TimeZone.getDefault()) - .setDateFormat(new SimpleDateFormat(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getFormat())) - .registerModules(buildCustomModule(), buildJavaTimeModule()) - .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .setSerializationInclusion(Include.NON_NULL); - } - - /** - * @return Java类型转换模块 - */ - private static final Module buildCustomModule() { - final SimpleModule customModule = new SimpleModule("CustomModule"); - // 注意不能转换Long类型数据:请求数据类型变化 + /** + * JSON转Java + * + * @param Java类型 + * @param json JSON + * @param clazz Java类型 + * @return Java + */ + public static final T toJava(String json, Class clazz) { + if (Objects.isNull(json) || Objects.isNull(clazz)) { + return null; + } + try { + return MAPPER.readValue(json, clazz); + } catch (IOException e) { + throw new RuntimeException("JSON转Java失败:" + json, e); + } + } + + /** + * JSON转Java + * + * @param Java类型 + * @param json JSON + * @param type Java类型 + * @return Java + */ + public static final T toJava(String json, TypeReference type) { + if (Objects.isNull(json) || Objects.isNull(type)) { + return null; + } + try { + return MAPPER.readValue(json, type); + } catch (IOException e) { + throw new RuntimeException("JSON转Java失败:" + json, e); + } + } + + /** + * JSON转Map + * + * @param K类型 + * @param V类型 + * @param json JSON + * @return Map + */ + public static final Map toMap(String json) { + if (Objects.isNull(json)) { + return new HashMap<>(); + } + try { + return MAPPER.readValue(json, new TypeReference>() { + }); + } catch (IOException e) { + throw new RuntimeException("JSON转Map失败:" + json, e); + } + } + + /** + * JSON转List + * + * @param 元素类型 + * @param json JSON + * @return List + */ + public static final List toList(String json) { + if (Objects.isNull(json)) { + return new ArrayList<>(); + } + try { + return MAPPER.readValue(json, new TypeReference>() { + }); + } catch (IOException e) { + throw new RuntimeException("JSON转List失败:" + json, e); + } + } + + /** + * JSON转List + * + * @param 元素类型 + * @param json JSON + * @param clazz 类型 + * @return List + */ + public static final List toList(String json, Class clazz) { + if (Objects.isNull(json)) { + return new ArrayList<>(); + } + try { + return MAPPER.readValue(json, new TypeReference>() { + }); + } catch (IOException e) { + throw new RuntimeException("JSON转List失败:" + json, e); + } + } + + /** + * @return Mapper + */ + public static final ObjectMapper buildMapper() { + final ObjectMapper mapper = new ObjectMapper(); + return mapper + .setTimeZone(TimeZone.getDefault()) + .setDateFormat(new SimpleDateFormat(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getFormat())) + .registerModules(buildCustomModule(), buildJavaTimeModule()) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .setSerializationInclusion(Include.NON_NULL); + } + + /** + * @return Java类型转换模块 + */ + private static final Module buildCustomModule() { + final SimpleModule customModule = new SimpleModule("CustomModule"); + // 注意不能转换Long类型数据:请求数据类型变化 // customModule.addSerializer(Long.class, ToStringSerializer.instance); - return customModule; - } - - /** - * @return Java时间类型模块 - */ - private static final JavaTimeModule buildJavaTimeModule() { - final JavaTimeModule javaTimeModule = new JavaTimeModule(); - javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateUtils.TimeStyle.HH24_MM_SS.getDateTimeFormatter())); - javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateUtils.DateStyle.YYYY_MM_DD.getDateTimeFormatter())); - javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getDateTimeFormatter())); - javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateUtils.TimeStyle.HH24_MM_SS.getDateTimeFormatter())); - javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateUtils.DateStyle.YYYY_MM_DD.getDateTimeFormatter())); - javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getDateTimeFormatter())); - return javaTimeModule; - } + return customModule; + } + + /** + * @return Java时间类型模块 + */ + private static final JavaTimeModule buildJavaTimeModule() { + final JavaTimeModule javaTimeModule = new JavaTimeModule(); + javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateUtils.TimeStyle.HH24_MM_SS.getDateTimeFormatter())); + javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateUtils.DateStyle.YYYY_MM_DD.getDateTimeFormatter())); + javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getDateTimeFormatter())); + javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateUtils.TimeStyle.HH24_MM_SS.getDateTimeFormatter())); + javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateUtils.DateStyle.YYYY_MM_DD.getDateTimeFormatter())); + javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateUtils.DateTimeStyle.YYYY_MM_DD_HH24_MM_SS.getDateTimeFormatter())); + return javaTimeModule; + } } diff --git a/taoyao-client-android/taoyao/client/build.gradle b/taoyao-client-android/taoyao/client/build.gradle index 565859a..0b53015 100644 --- a/taoyao-client-android/taoyao/client/build.gradle +++ b/taoyao-client-android/taoyao/client/build.gradle @@ -30,13 +30,11 @@ android { dependencies { implementation project(path: ':boot') - implementation project(path: ':mediasoup') + implementation project(path: ':media') implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } diff --git a/taoyao-client-android/taoyao/client/src/main/AndroidManifest.xml b/taoyao-client-android/taoyao/client/src/main/AndroidManifest.xml index 2519906..4869b92 100644 --- a/taoyao-client-android/taoyao/client/src/main/AndroidManifest.xml +++ b/taoyao-client-android/taoyao/client/src/main/AndroidManifest.xml @@ -1,6 +1,8 @@ + + map = new HashMap<>(); - if(args != null) { - for (int index = 0; index < args.length; index+=2) { + if (args != null) { + for (int index = 0; index < args.length; index += 2) { map.put(args[index], args[index + 1]); } } @@ -293,11 +316,11 @@ public class Taoyao { // log.debug("收到消息:{}", new String(this.decrypt.doFinal(message))); System.out.println(content); final Message message = JSONUtils.toJava(content, Message.class); - if(message == null) { + if (message == null) { return; } final Header header = message.getHeader(); - if(header == null) { + if (header == null) { return; } final Map body = message.body(); diff --git a/taoyao-client-android/taoyao/mediasoup/.gitignore b/taoyao-client-android/taoyao/media/.gitignore similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/.gitignore rename to taoyao-client-android/taoyao/media/.gitignore diff --git a/taoyao-client-android/taoyao/media/CMakeLists.txt b/taoyao-client-android/taoyao/media/CMakeLists.txt new file mode 100644 index 0000000..f5e61ea --- /dev/null +++ b/taoyao-client-android/taoyao/media/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 3.22.1) + +project(taoyao VERSION 1.0.0 LANGUAGES C CXX) + +# Debug | Release +#-DCMAKE_BUILD_TYPE=Debug +#set(CMAKE_BUILD_TYPE Debug) + +# C编译选项 +set(CMAKE_C_STANDARD 17) +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -O3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c17 -O0 -g") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c17 -O3") + +# C++编译选项 +set(CMAKE_CXX_STANDARD 17) +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -O0 -g") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O3") + +set( + SOURCE_DIR + src/main/cpp/ +) + +set( + SOURCE_FILES + ${SOURCE_DIR}/main.hpp + ${SOURCE_DIR}/main.cpp +) + +set(LIBWEBRTC_BINARY_PATH ${LIBWEBRTC_BINARY_PATH}/${ANDROID_ABI} CACHE STRING "libwebrtc binary path" FORCE) + +if (${MEDIASOUPCLIENT_LOG_TRACE}) + target_compile_definitions( + ${PROJECT_NAME} PRIVATE MSC_LOG_TRACE=1 + ) +endif () + +if (${MEDIASOUPCLIENT_LOG_DEV}) + target_compile_definitions( + ${PROJECT_NAME} PRIVATE MSC_LOG_DEV=1 + ) +endif () + +add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) + +add_subdirectory("deps/libmediasoupclient") + +set_source_files_properties( + ${SOURCE_FILES} PROPERTIES COMPILE_FLAGS -Wall -Wextra -Wpedantic +) + +target_include_directories( + ${PROJECT_NAME} PUBLIC + "${SOURCE_DIR}/include" + "${PROJECT_SOURCE_DIR}/deps/libmediasoupclient/include" + "${PROJECT_SOURCE_DIR}/deps/libmediasoupclient/deps/libsdptransform/include" +) + +target_link_libraries( + ${PROJECT_NAME} PUBLIC + log + android + OpenSLES + mediasoupclient +) diff --git a/taoyao-client-android/taoyao/mediasoup/build.gradle b/taoyao-client-android/taoyao/media/build.gradle similarity index 66% rename from taoyao-client-android/taoyao/mediasoup/build.gradle rename to taoyao-client-android/taoyao/media/build.gradle index 0612e9a..df25d77 100644 --- a/taoyao-client-android/taoyao/mediasoup/build.gradle +++ b/taoyao-client-android/taoyao/media/build.gradle @@ -14,7 +14,6 @@ android { versionCode 100 versionName "1.0.0" consumerProguardFiles "consumer-rules.pro" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { cFlags '-std=c17' @@ -22,10 +21,10 @@ android { // CPU架构:x86_64、x86、arm64-v8a、armeabi-v7a abiFilters 'arm64-v8a' arguments "-DLIBWEBRTC_INCLUDE_PATH=" + WEBRTC_INC_PATH, - "-DLIBWEBRTC_BINARY_PATH=" + WEBRTC_LIB_PATH, - "-DMEDIASOUPCLIENT_BUILD_TESTS=OFF", - "-DMEDIASOUPCLIENT_LOG_TRACE=OFF", - "-DMEDIASOUPCLIENT_LOG_DEV=OFF" + "-DLIBWEBRTC_BINARY_PATH=" + WEBRTC_LIB_PATH, + "-DMEDIASOUPCLIENT_BUILD_TESTS=OFF", + "-DMEDIASOUPCLIENT_LOG_TRACE=OFF", + "-DMEDIASOUPCLIENT_LOG_DEV=OFF" } } } @@ -48,11 +47,8 @@ android { } dependencies { - api fileTree(dir: WEBRTC_LIB_PATH, include: ['libwebrtc.jar']) implementation fileTree(dir: 'libs', include: ['*.a', '*.so', '*.jar']) - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } diff --git a/taoyao-client-android/taoyao/mediasoup/consumer-rules.pro b/taoyao-client-android/taoyao/media/consumer-rules.pro similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/consumer-rules.pro rename to taoyao-client-android/taoyao/media/consumer-rules.pro diff --git a/taoyao-client-android/taoyao/mediasoup/libs/libwebrtc.jar b/taoyao-client-android/taoyao/media/libs/libwebrtc.jar similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/libs/libwebrtc.jar rename to taoyao-client-android/taoyao/media/libs/libwebrtc.jar diff --git a/taoyao-client-android/taoyao/mediasoup/proguard-rules.pro b/taoyao-client-android/taoyao/media/proguard-rules.pro similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/proguard-rules.pro rename to taoyao-client-android/taoyao/media/proguard-rules.pro diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/AndroidManifest.xml b/taoyao-client-android/taoyao/media/src/main/AndroidManifest.xml similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/AndroidManifest.xml rename to taoyao-client-android/taoyao/media/src/main/AndroidManifest.xml diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/AudioPublisher.hpp b/taoyao-client-android/taoyao/media/src/main/cpp/include/AudioPublisher.hpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/AudioPublisher.hpp rename to taoyao-client-android/taoyao/media/src/main/cpp/include/AudioPublisher.hpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/MediaPublisher.hpp b/taoyao-client-android/taoyao/media/src/main/cpp/include/MediaPublisher.hpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/MediaPublisher.hpp rename to taoyao-client-android/taoyao/media/src/main/cpp/include/MediaPublisher.hpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/MediaRecorder.hpp b/taoyao-client-android/taoyao/media/src/main/cpp/include/MediaRecorder.hpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/MediaRecorder.hpp rename to taoyao-client-android/taoyao/media/src/main/cpp/include/MediaRecorder.hpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/VideoPublisher.hpp b/taoyao-client-android/taoyao/media/src/main/cpp/include/VideoPublisher.hpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/include/VideoPublisher.hpp rename to taoyao-client-android/taoyao/media/src/main/cpp/include/VideoPublisher.hpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.cpp b/taoyao-client-android/taoyao/media/src/main/cpp/main.cpp similarity index 83% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.cpp rename to taoyao-client-android/taoyao/media/src/main/cpp/main.cpp index 84da2fc..d3b1845 100644 --- a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.cpp +++ b/taoyao-client-android/taoyao/media/src/main/cpp/main.cpp @@ -5,10 +5,11 @@ extern "C" JNIEXPORT jstring JNICALL Java_com_acgist_taoyao_client_MainActivity_stringFromJNI( - JNIEnv* env, - jobject /* this */) { + JNIEnv *env, + jobject /* this */ +) { mediasoupclient::Device device; - if(device.IsLoaded()) { + if (device.IsLoaded()) { std::string hello = "Hello from C++ true"; return env->NewStringUTF(hello.c_str()); } else { diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.hpp b/taoyao-client-android/taoyao/media/src/main/cpp/main.hpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.hpp rename to taoyao-client-android/taoyao/media/src/main/cpp/main.hpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/AudioPublisher.cpp b/taoyao-client-android/taoyao/media/src/main/cpp/media/AudioPublisher.cpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/AudioPublisher.cpp rename to taoyao-client-android/taoyao/media/src/main/cpp/media/AudioPublisher.cpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/MediaPublisher.cpp b/taoyao-client-android/taoyao/media/src/main/cpp/media/MediaPublisher.cpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/MediaPublisher.cpp rename to taoyao-client-android/taoyao/media/src/main/cpp/media/MediaPublisher.cpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/MediaRecorder.cpp b/taoyao-client-android/taoyao/media/src/main/cpp/media/MediaRecorder.cpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/MediaRecorder.cpp rename to taoyao-client-android/taoyao/media/src/main/cpp/media/MediaRecorder.cpp diff --git a/taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/VideoPublisher.cpp b/taoyao-client-android/taoyao/media/src/main/cpp/media/VideoPublisher.cpp similarity index 100% rename from taoyao-client-android/taoyao/mediasoup/src/main/cpp/media/VideoPublisher.cpp rename to taoyao-client-android/taoyao/media/src/main/cpp/media/VideoPublisher.cpp diff --git a/taoyao-client-android/taoyao/mediasoup/CMakeLists.txt b/taoyao-client-android/taoyao/mediasoup/CMakeLists.txt deleted file mode 100644 index fe307ab..0000000 --- a/taoyao-client-android/taoyao/mediasoup/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ -cmake_minimum_required(VERSION 3.22.1) - -project(taoyao VERSION 1.0.0 LANGUAGES C CXX) - -# Debug | Release -# -DCMAKE_BUILD_TYPE=Debug -# set(CMAKE_BUILD_TYPE Debug) - -# C编译选项 -#set(CMAKE_C_STANDARD 17) -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17 -O3") -#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -std=c17 -O0 -g") -#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c17 -O3") - -# C++编译选项 -#set(CMAKE_CXX_STANDARD 17) -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3") -#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -O0 -g") -#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O3") - -set( - SOURCE_DIR - src/main/cpp/ -) - -set( - SOURCE_FILES - ${SOURCE_DIR}/main.hpp - ${SOURCE_DIR}/main.cpp -) - -set(LIBWEBRTC_BINARY_PATH ${LIBWEBRTC_BINARY_PATH}/${ANDROID_ABI} CACHE STRING "libwebrtc binary path" FORCE) - -if (${MEDIASOUPCLIENT_LOG_TRACE}) - target_compile_definitions( - ${PROJECT_NAME} PRIVATE MSC_LOG_TRACE=1 - ) -endif () - -if (${MEDIASOUPCLIENT_LOG_DEV}) - target_compile_definitions( - ${PROJECT_NAME} PRIVATE MSC_LOG_DEV=1 - ) -endif () - -add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) - -add_subdirectory("deps/libmediasoupclient") - -set_source_files_properties( - ${SOURCE_FILES} PROPERTIES COMPILE_FLAGS -Wall -Wextra -Wpedantic -) - -target_include_directories( - ${PROJECT_NAME} PUBLIC - "${SOURCE_DIR}/include" - "${PROJECT_SOURCE_DIR}/deps/libmediasoupclient/include" - "${PROJECT_SOURCE_DIR}/deps/libmediasoupclient/deps/libsdptransform/include" -) - -target_compile_definitions( - ${PROJECT_NAME} PUBLIC - $<$>:WEBRTC_POSIX> - $<$:WEBRTC_MAC> - $<$:NOMINMAX> - $<$:WEBRTC_WIN> - $<$:WIN32_LEAN_AND_MEAN> -) - -target_link_libraries( - ${PROJECT_NAME} PUBLIC - log - android - OpenSLES - mediasoupclient -) diff --git a/taoyao-client-android/taoyao/settings.gradle b/taoyao-client-android/taoyao/settings.gradle index 9562c96..a687fba 100644 --- a/taoyao-client-android/taoyao/settings.gradle +++ b/taoyao-client-android/taoyao/settings.gradle @@ -14,5 +14,5 @@ dependencyResolutionManagement { } rootProject.name = "taoyao" include ':boot' +include ':media' include ':client' -include ':mediasoup' diff --git a/taoyao-signal-server/README.md b/taoyao-signal-server/README.md index 5f62132..6f9c815 100644 --- a/taoyao-signal-server/README.md +++ b/taoyao-signal-server/README.md @@ -12,4 +12,3 @@ ## 信令格式 [信令格式](https://localhost:8888/protocol/list) -