[*] 每日优化

This commit is contained in:
acgist
2023-05-14 09:56:32 +08:00
parent 8430fa78a8
commit 9db40b629d
15 changed files with 85 additions and 44 deletions

View File

@@ -23,8 +23,8 @@
|:--|:--|:--|
|taoyao-client-web|Web终端|Web终端|
|taoyao-client-media|媒体终端|媒体服务|
|taoyao-signal-server|信令服务|终端信令控制|
|taoyao-client-android|安卓终端|安卓终端|
|taoyao-signal-server|信令服务|终端信令控制|
### Web终端功能

View File

@@ -34,7 +34,9 @@ getter/setter
* 录制底噪
* 分辨率调整
* 降低视频录制大小
* 防止重复邀请拉取
* 查询消费者生产者信息
* 浏览器WebRTC监控页面关闭
## 完成任务

View File

@@ -0,0 +1,9 @@
# 桃夭安卓
## WebRTC源码修改
### JavaAudioDeviceModule
### WebRtcAudioRecord
### WebRtcAudioTrack

View File

@@ -26,17 +26,20 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:enabled="true"
android:exported="false"
android:label="@string/title_activity_settings"
android:theme="@style/Theme.Taoyao" />
<service
android:name=".MediaService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="camera|location|microphone|mediaProjection" />
<receiver
android:name=".TaoyaoReceiver"
android:enabled="true"

View File

@@ -89,8 +89,8 @@ public class MediaService extends Service {
""");
super.onCreate();
final Resources resources = this.getResources();
this.mkdir(resources.getString(R.string.storagePathImage), Environment.DIRECTORY_PICTURES);
this.mkdir(resources.getString(R.string.storagePathVideo), Environment.DIRECTORY_MOVIES);
this.mkdir(resources.getString(R.string.imagePath), Environment.DIRECTORY_PICTURES);
this.mkdir(resources.getString(R.string.videoPath), Environment.DIRECTORY_MOVIES);
this.settingAudio();
this.buildNotificationChannel();
}
@@ -158,8 +158,8 @@ public class MediaService extends Service {
resources.getBoolean(R.bool.broadcaster),
resources.getInteger(R.integer.channelCount),
resources.getInteger(R.integer.iFrameInterval),
resources.getString(R.string.storagePathImage),
resources.getString(R.string.storagePathVideo),
resources.getString(R.string.imagePath),
resources.getString(R.string.videoPath),
resources.getString(R.string.watermark),
VideoSourceType.valueOf(resources.getString(R.string.videoSourceType))
);
@@ -209,9 +209,12 @@ public class MediaService extends Service {
}
// 连接信令
this.taoyao = new Taoyao(
resources.getString(R.string.version), resources.getString(R.string.clientType),
resources.getString(R.string.version),
resources.getString(R.string.clientType),
port, host, name, clientId, username, password,
resources.getInteger(R.integer.timeout), resources.getString(R.string.encrypt), resources.getString(R.string.encryptSecret),
resources.getInteger(R.integer.timeout),
resources.getString(R.string.encrypt),
resources.getString(R.string.encryptSecret),
MediaService.mainHandler, context, this.taoyaoListener
);
MediaManager.getInstance().initTaoyao(this.taoyao);

View File

@@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,15l5.88,0c0.27,-0.31 0.67,-0.5 1.12,-0.5c0.83,0 1.5,0.67 1.5,1.5c0,0.83 -0.67,1.5 -1.5,1.5c-0.44,0 -0.84,-0.19 -1.12,-0.5l-3.98,0c-0.46,2.28 -2.48,4 -4.9,4c-2.76,0 -5,-2.24 -5,-5c0,-2.42 1.72,-4.44 4,-4.9l0,2.07C4.84,13.58 4,14.7 4,16c0,1.65 1.35,3 3,3s3,-1.35 3,-3V15zM12.5,4c1.65,0 3,1.35 3,3h2c0,-2.76 -2.24,-5 -5,-5l0,0c-2.76,0 -5,2.24 -5,5c0,1.43 0.6,2.71 1.55,3.62l-2.35,3.9C6.02,14.66 5.5,15.27 5.5,16c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5c0,-0.16 -0.02,-0.31 -0.07,-0.45l3.38,-5.63C10.49,9.61 9.5,8.42 9.5,7C9.5,5.35 10.85,4 12.5,4zM17,13c-0.64,0 -1.23,0.2 -1.72,0.54l-3.05,-5.07C11.53,8.35 11,7.74 11,7c0,-0.83 0.67,-1.5 1.5,-1.5S14,6.17 14,7c0,0.15 -0.02,0.29 -0.06,0.43l2.19,3.65C16.41,11.03 16.7,11 17,11l0,0c2.76,0 5,2.24 5,5c0,2.76 -2.24,5 -5,5c-1.85,0 -3.47,-1.01 -4.33,-2.5l2.67,0C15.82,18.82 16.39,19 17,19c1.65,0 3,-1.35 3,-3S18.65,13 17,13z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M10,15l5.88,0c0.27,-0.31 0.67,-0.5 1.12,-0.5c0.83,0 1.5,0.67 1.5,1.5c0,0.83 -0.67,1.5 -1.5,1.5c-0.44,0 -0.84,-0.19 -1.12,-0.5l-3.98,0c-0.46,2.28 -2.48,4 -4.9,4c-2.76,0 -5,-2.24 -5,-5c0,-2.42 1.72,-4.44 4,-4.9l0,2.07C4.84,13.58 4,14.7 4,16c0,1.65 1.35,3 3,3s3,-1.35 3,-3V15zM12.5,4c1.65,0 3,1.35 3,3h2c0,-2.76 -2.24,-5 -5,-5l0,0c-2.76,0 -5,2.24 -5,5c0,1.43 0.6,2.71 1.55,3.62l-2.35,3.9C6.02,14.66 5.5,15.27 5.5,16c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5c0,-0.16 -0.02,-0.31 -0.07,-0.45l3.38,-5.63C10.49,9.61 9.5,8.42 9.5,7C9.5,5.35 10.85,4 12.5,4zM17,13c-0.64,0 -1.23,0.2 -1.72,0.54l-3.05,-5.07C11.53,8.35 11,7.74 11,7c0,-0.83 0.67,-1.5 1.5,-1.5S14,6.17 14,7c0,0.15 -0.02,0.29 -0.06,0.43l2.19,3.65C16.41,11.03 16.7,11 17,11l0,0c2.76,0 5,2.24 5,5c0,2.76 -2.24,5 -5,5c-1.85,0 -3.47,-1.01 -4.33,-2.5l2.67,0C15.82,18.82 16.39,19 17,19c1.65,0 3,-1.35 3,-3S18.65,13 17,13z" />
</vector>

View File

@@ -1,6 +1,13 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="@android:color/white"
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</vector>

View File

@@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,10.48V6c0,-1.1 -0.9,-2 -2,-2H4C2.9,4 2,4.9 2,6v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-4.48l4,3.98v-11L18,10.48zM12,12l3,1.73l-1,1.73l-3,-1.73V17H9v-3.27l-3,1.73l-1,-1.73L8,12l-3,-1.73l1,-1.73l3,1.73V7h2v3.27l3,-1.73l1,1.73L12,12z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,10.48V6c0,-1.1 -0.9,-2 -2,-2H4C2.9,4 2,4.9 2,6v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-4.48l4,3.98v-11L18,10.48zM12,12l3,1.73l-1,1.73l-3,-1.73V17H9v-3.27l-3,1.73l-1,-1.73L8,12l-3,-1.73l1,-1.73l3,1.73V7h2v3.27l3,-1.73l1,1.73L12,12z" />
</vector>

View File

@@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z" />
</vector>

View File

@@ -11,9 +11,7 @@
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2">
</GridLayout>
android:columnCount="2"></GridLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/settings"

View File

@@ -16,12 +16,6 @@
<string name="encrypt">DES</string>
<!-- 信令加密密钥 -->
<string name="encryptSecret">2SPWy+TF1zM=</string>
<!-- 图片存储目录 -->
<string name="storagePathImage">/taoyao</string>
<!-- 视频存储目录 -->
<string name="storagePathVideo">/taoyao</string>
<!-- 视频来源FILE|BACK|FRONT|SCREEN -->
<string name="videoSourceType">BACK</string>
<!-- 媒体配置:是否消费数据 -->
<bool name="dataConsume">false</bool>
<!-- 媒体配置:是否消费音频 -->
@@ -46,6 +40,12 @@
<integer name="channelCount">1</integer>
<!-- 视频关键帧频率 -->
<integer name="iFrameInterval">1</integer>
<!-- 图片存储目录 -->
<string name="imagePath">/taoyao</string>
<!-- 视频存储目录 -->
<string name="videoPath">/taoyao</string>
<!-- 水印 -->
<string name="watermark">"'TAOYAO' yyyy-MM-dd HH:mm:ss"</string>
<!-- 视频来源FILE|BACK|FRONT|SCREEN -->
<string name="videoSourceType">BACK</string>
</resources>

View File

@@ -3,10 +3,10 @@
<string name="app_name">桃夭</string>
<string name="title_activity_main">桃夭终端预览</string>
<string name="title_activity_settings">桃夭终端设置</string>
<string name="button_photograph">拍照</string>
<string name="button_action">动作</string>
<string name="button_record">录像</string>
<string name="button_setting">设置</string>
<string name="button_photograph">拍照</string>
<string name="button_connect">连接</string>
<string name="signal_port">信令端口</string>
<string name="signal_host">信令地址</string>

View File

@@ -1,6 +1,6 @@
#Mon Mar 20 09:51:37 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists

View File

@@ -1,16 +1,17 @@
/**
* 音频默认配置
* TODOMediaStreamTrack.applyConstraints()
* 播放音量、采集音量
* TODO播放音量audio标签配置、采集音量
* 支持属性navigator.mediaDevices.getSupportedConstraints()
* https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings
*/
const defaultAudioConfig = {
// 设备
// deviceId : '',
// 音量0~1
volume: 1.0,
// 延迟大小(单位500毫秒以内较好
latency: 0.4,
// 音量废弃0.0~1.0
// volume: 1.0,
// 延迟时间(单位500毫秒以内较好
// latency: 0.4,
// 采样位数8|16|32
sampleSize: { min: 8, ideal: 16, max: 32 },
// 采样率8000|16000|32000|48000
@@ -18,7 +19,7 @@ const defaultAudioConfig = {
// 声道数量1|2
channelCount: 1,
// 是否开启自动增益true|false
autoGainControl: false,
autoGainControl: true,
// 是否开启降噪功能true|false
noiseSuppression: true,
// 是否开启回音消除true|false

View File

@@ -1539,6 +1539,7 @@ class Taoyao extends RemoteClient {
this.callbackError("无效房间");
return;
}
// TODO已经进入房间忽略
me.roomId = roomId;
const response = await me.request(
protocol.buildMessage("media::router::rtp::capabilities", {
@@ -1581,6 +1582,7 @@ class Taoyao extends RemoteClient {
if (clientId === me.clientId) {
// 忽略自己
} else {
// TODO已经存在忽略
me.remoteClients.set(clientId, new RemoteClient(status));
}
}
@@ -1634,6 +1636,7 @@ class Taoyao extends RemoteClient {
const me = this;
// 默认进入,如果需要确认使用回调函数重写。
const { roomId, password } = message.body;
// TODO已经进入房间拒绝
// if(me.roomId) {
// this.callbackError();
// return;