[*] android开发环境配置完成
This commit is contained in:
@@ -26,6 +26,12 @@
|
|||||||
|taoyao-client-android|安卓终端|安卓终端|
|
|taoyao-client-android|安卓终端|安卓终端|
|
||||||
|taoyao-signal-server|信令服务|终端信令控制|
|
|taoyao-signal-server|信令服务|终端信令控制|
|
||||||
|
|
||||||
|
## 功能
|
||||||
|
|
||||||
|
Web、信令已经完成大部分音视频功能,还有部分视频质量调整功能没有完成。
|
||||||
|
|
||||||
|
Android还在学习之中...
|
||||||
|
|
||||||
## 证书
|
## 证书
|
||||||
|
|
||||||
本地开发测试安装`docs/certs`中的`ca.crt`证书
|
本地开发测试安装`docs/certs`中的`ca.crt`证书
|
||||||
|
|||||||
148
docs/Deploy.md
148
docs/Deploy.md
@@ -93,6 +93,24 @@ gcc -v
|
|||||||
g++ -v
|
g++ -v
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 安装CMake
|
||||||
|
|
||||||
|
```
|
||||||
|
# 下载
|
||||||
|
mkdir -p /data/dev/cmake
|
||||||
|
cd /data/dev/cmake
|
||||||
|
wget https://github.com/Kitware/CMake/releases/download/v3.26.0/cmake-3.26.0.tar.gz
|
||||||
|
|
||||||
|
# 安装
|
||||||
|
tar -zxvf cmake-3.26.0.tar.gz
|
||||||
|
cd cmake-3.26.0
|
||||||
|
./configure
|
||||||
|
make && make install
|
||||||
|
|
||||||
|
# 验证
|
||||||
|
cmake -v
|
||||||
|
```
|
||||||
|
|
||||||
## 安装Node
|
## 安装Node
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -260,6 +278,90 @@ SELINUX=disabled
|
|||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## libwebrtc(可选)
|
||||||
|
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/android/
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/development/
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/development/prerequisite-sw/
|
||||||
|
https://www.chromium.org/developers/how-tos/install-depot-tools/
|
||||||
|
|
||||||
|
建议直接购买国外的按需使用的主机,用完直接释放,配置建议:
|
||||||
|
|
||||||
|
* 内存`8G`
|
||||||
|
* 四核`CPU`
|
||||||
|
* 硬盘`100G`
|
||||||
|
* 系统`Ubuntu 20.xx`
|
||||||
|
* 宽带按需`100Mbps/s`(不要固定宽带)
|
||||||
|
* 整个编译过程大概需要两到三个小时(不会下载回来很慢)
|
||||||
|
|
||||||
|
```
|
||||||
|
# 编译工具
|
||||||
|
mkdir -p /data
|
||||||
|
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
|
|
||||||
|
# 源码
|
||||||
|
mkdir -p /data/webrtc
|
||||||
|
cd /data/webrtc
|
||||||
|
fetch --nohooks webrtc_android
|
||||||
|
/data/depot_tools/gclient sync
|
||||||
|
|
||||||
|
# 分支
|
||||||
|
cd src
|
||||||
|
git checkout -b m94 branch-heads/4606
|
||||||
|
/data/depot_tools/gclient sync
|
||||||
|
|
||||||
|
# 编译依赖
|
||||||
|
./build/install-build-deps.sh
|
||||||
|
./build/install-build-deps-android.sh
|
||||||
|
source ./build/android/envsetup.sh
|
||||||
|
|
||||||
|
---
|
||||||
|
'target_os': 'android',
|
||||||
|
'is_clang': True,
|
||||||
|
'is_debug': False,
|
||||||
|
'use_rtti': True,
|
||||||
|
'rtc_use_h264': True,
|
||||||
|
'use_custom_libcxx': False,
|
||||||
|
'rtc_include_tests': False,
|
||||||
|
'is_component_build': False,
|
||||||
|
'treat_warnings_as_errors': False,
|
||||||
|
'use_goma': use_goma,
|
||||||
|
'target_cpu': _GetTargetCpu(arch)
|
||||||
|
---
|
||||||
|
|
||||||
|
# 编译.so
|
||||||
|
./tools_webrtc/android/build_aar.py --build-dir ./out/release-build/
|
||||||
|
# 指定CPU架构:--arch x86 x86_64 arm64-v8a armeabi-v7a
|
||||||
|
|
||||||
|
# 编译.a
|
||||||
|
/data/depot_tools/autoninja -C ./out/release-build/x86 webrtc &&
|
||||||
|
/data/depot_tools/autoninja -C ./out/release-build/x86_64 webrtc &&
|
||||||
|
/data/depot_tools/autoninja -C ./out/release-build/arm64-v8a webrtc &&
|
||||||
|
/data/depot_tools/autoninja -C ./out/release-build/armeabi-v7a webrtc
|
||||||
|
|
||||||
|
# 依赖打包
|
||||||
|
zip -r webrtc.zip out libwebrtc.aar
|
||||||
|
```
|
||||||
|
|
||||||
|
[WebRTC](https://pan.baidu.com/s/1E_DXv32D9ODyj5J-o-ji_g?pwd=hudc)
|
||||||
|
|
||||||
|
## libmediasoupclient(可选)
|
||||||
|
|
||||||
|
https://mediasoup.org/documentation/v3/libmediasoupclient/installation/
|
||||||
|
|
||||||
|
```
|
||||||
|
# 编译
|
||||||
|
cmake . -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug | Release \
|
||||||
|
-DMEDIASOUPCLIENT_LOG_DEV=OFF \
|
||||||
|
-DMEDIASOUPCLIENT_LOG_TRACE=OFF \
|
||||||
|
-DMEDIASOUPCLIENT_BUILD_TESTS=OFF \
|
||||||
|
-DLIBWEBRTC_INCLUDE_PATH:PATH=PATH_TO_LIBWEBRTC_SOURCES \
|
||||||
|
-DLIBWEBRTC_BINARY_PATH:PATH=PATH_TO_LIBWEBRTC_BINARY
|
||||||
|
make -C build
|
||||||
|
make install -C build
|
||||||
|
```
|
||||||
|
|
||||||
## 下载源码
|
## 下载源码
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -329,7 +431,7 @@ systemctl enable taoyao-signal-server
|
|||||||
systemctl start | stop | restart taoyao-signal-server
|
systemctl start | stop | restart taoyao-signal-server
|
||||||
```
|
```
|
||||||
|
|
||||||
## 安装终端
|
## 安装Web终端
|
||||||
|
|
||||||
```
|
```
|
||||||
# 编译代码
|
# 编译代码
|
||||||
@@ -352,6 +454,12 @@ cp /data/taoyao/docs/etc/nginx.conf /etc/nginx/nginx.conf
|
|||||||
nginx -s reload
|
nginx -s reload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 安装Android终端
|
||||||
|
|
||||||
|
```
|
||||||
|
# Android Studio
|
||||||
|
```
|
||||||
|
|
||||||
## 配置防火墙
|
## 配置防火墙
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -415,3 +523,41 @@ openssl x509 -in server.crt -subject -issuer -noout
|
|||||||
# issuer= /C=cn/ST=gd/L=gz/O=acgist/OU=acgist/CN=acgist.com
|
# issuer= /C=cn/ST=gd/L=gz/O=acgist/OU=acgist/CN=acgist.com
|
||||||
openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12 -name taoyao
|
openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12 -name taoyao
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## licenses
|
||||||
|
|
||||||
|
```
|
||||||
|
List of licenses:
|
||||||
|
webrtc,
|
||||||
|
abseil-cpp,
|
||||||
|
android_deps,
|
||||||
|
android_deps:com_android_support_support_annotations.*,
|
||||||
|
android_ndk,
|
||||||
|
android_sdk,
|
||||||
|
androidx,
|
||||||
|
base64,
|
||||||
|
boringssl,
|
||||||
|
crc32c,
|
||||||
|
fft,
|
||||||
|
fiat,
|
||||||
|
g711,
|
||||||
|
g722,
|
||||||
|
ijar,
|
||||||
|
jdk,
|
||||||
|
libaom,
|
||||||
|
libevent,
|
||||||
|
libjpeg_turbo,
|
||||||
|
libsrtp,
|
||||||
|
libvpx,
|
||||||
|
libyuv,
|
||||||
|
nasm,
|
||||||
|
ooura,
|
||||||
|
opus,
|
||||||
|
pffft,
|
||||||
|
protobuf,
|
||||||
|
rnnoise,
|
||||||
|
sigslot,
|
||||||
|
spl_sqrt_floor,
|
||||||
|
usrsctp,
|
||||||
|
zlib
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
# 安卓终端
|
# 安卓终端
|
||||||
|
|
||||||
|
注意:功能还没完成
|
||||||
|
|
||||||
## C++终端
|
## C++终端
|
||||||
|
|
||||||
* [libmediasoupclient源码](https://github.com/versatica/libmediasoupclient)
|
* [libmediasoupclient源码](https://github.com/versatica/libmediasoupclient)
|
||||||
* [libmediasoupclient文档](https://mediasoup.org/documentation/v3/libmediasoupclient)
|
* [libmediasoupclient文档](https://mediasoup.org/documentation/v3/libmediasoupclient)
|
||||||
* [libmediasoupclient接口](https://mediasoup.org/documentation/v3/libmediasoupclient/api)
|
* [libmediasoupclient接口](https://mediasoup.org/documentation/v3/libmediasoupclient/api)
|
||||||
|
|
||||||
|
## 项目配置
|
||||||
|
|
||||||
|
可以自己编译`WebRTC`依赖或者下载已有依赖,
|
||||||
|
项目导入以后拷贝`libmediasoupclient`源码还有`WebRTC`头文件和二进制文件到`deps`目录。
|
||||||
|
|
||||||
|
[WebRTC](https://pan.baidu.com/s/1E_DXv32D9ODyj5J-o-ji_g?pwd=hudc)
|
||||||
|
|
||||||
|
> 注意删除目录`src/build/linux`和`third_party`目录中除了`abseil-cpp`以外的所有依赖(当然不删也没关系就是文件太多编译器会变慢)
|
||||||
|
|
||||||
## 学习资料
|
## 学习资料
|
||||||
|
|
||||||
https://developer.android.google.cn/docs?hl=zh-cn
|
https://developer.android.google.cn/docs?hl=zh-cn
|
||||||
https://developer.android.google.cn/guide?hl=zh-cn
|
https://developer.android.google.cn/guide?hl=zh-cn
|
||||||
|
|
||||||
|
## 依赖编译
|
||||||
|
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/android/
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/development/
|
||||||
|
https://webrtc.github.io/webrtc-org/native-code/development/prerequisite-sw/
|
||||||
|
https://www.chromium.org/developers/how-tos/install-depot-tools/
|
||||||
|
https://mediasoup.org/documentation/v3/libmediasoupclient/installation/
|
||||||
|
|
||||||
|
## 参考项目
|
||||||
|
|
||||||
|
https://github.com/haiyangwu/webrtc-android-build
|
||||||
|
https://github.com/haiyangwu/mediasoup-demo-android
|
||||||
|
https://github.com/haiyangwu/mediasoup-client-android
|
||||||
|
|
||||||
|
## 其他依赖
|
||||||
|
|
||||||
|
其他一些框架:
|
||||||
|
|
||||||
|
* `org.webrtc:google-webrtc`
|
||||||
|
* `io.github.haiyangwu:mediasoup-client`
|
||||||
|
|||||||
2
taoyao-client-android/taoyao/.gitignore
vendored
2
taoyao-client-android/taoyao/.gitignore
vendored
@@ -5,3 +5,5 @@ local.properties
|
|||||||
**/.gradle
|
**/.gradle
|
||||||
|
|
||||||
**/build
|
**/build
|
||||||
|
|
||||||
|
mediasoup/deps
|
||||||
@@ -10,6 +10,8 @@ android {
|
|||||||
targetSdk 32
|
targetSdk 32
|
||||||
versionCode 100
|
versionCode 100
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -17,9 +19,6 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildFeatures {
|
|
||||||
viewBinding true
|
|
||||||
}
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
@@ -30,4 +29,6 @@ dependencies {
|
|||||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
|
||||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
|
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
-optimizationpasses 5
|
|
||||||
@@ -12,14 +12,6 @@ android {
|
|||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
applicationId "com.acgist.taoyao.client"
|
applicationId "com.acgist.taoyao.client"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
|
||||||
cmake {
|
|
||||||
cFlags '-std=c17'
|
|
||||||
cppFlags '-std=c++17'
|
|
||||||
// CPU架构:x86_64、x86、armeabi-v7a、arm64-v8a
|
|
||||||
abiFilters 'arm64-v8a'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -34,17 +26,11 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_17
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
externalNativeBuild {
|
|
||||||
cmake {
|
|
||||||
path file('src/main/cpp/CMakeLists.txt')
|
|
||||||
version '3.22.1'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ':boot')
|
implementation project(path: ':boot')
|
||||||
implementation fileTree(dir: 'libs', include: ['*.so', '*.jar'])
|
implementation project(path: ':mediasoup')
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
implementation 'com.google.android.material:material:1.5.0'
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
-optimizationpasses 5
|
|
||||||
@@ -10,15 +10,15 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Taoyao">
|
android:theme="@style/Theme.Taoyao">
|
||||||
<service
|
<service
|
||||||
android:name=".client.MediaService"
|
android:name=".MediaService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".client.SettingsActivity"
|
android:name=".SettingsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_settings" />
|
android:label="@string/title_activity_settings" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".client.MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -1,48 +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(PROJECT_BINARY_DIR ${PROJECT_SOURCE_DIR}/build)
|
|
||||||
|
|
||||||
file(
|
|
||||||
GLOB SOURCE_FILE
|
|
||||||
"main.hpp"
|
|
||||||
"include/*.hpp"
|
|
||||||
"mediasoup/*.hpp"
|
|
||||||
"main.cpp"
|
|
||||||
"media/*.cpp"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(taoyao SHARED ${SOURCE_FILE})
|
|
||||||
find_library(
|
|
||||||
log-lib
|
|
||||||
log
|
|
||||||
)
|
|
||||||
target_link_libraries(
|
|
||||||
taoyao
|
|
||||||
${log-lib}
|
|
||||||
)
|
|
||||||
|
|
||||||
# 配置
|
|
||||||
# cmake -B build
|
|
||||||
# Windows:cmake -B build -G "Unix Makefiles"
|
|
||||||
# 编译
|
|
||||||
# cmake --build build
|
|
||||||
# 标准线程:-lpthread
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#include <jni.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
|
||||||
Java_com_acgist_taoyao_MainActivity_stringFromJNI(
|
|
||||||
JNIEnv* env,
|
|
||||||
jobject /* this */) {
|
|
||||||
std::string hello = "Hello from C++";
|
|
||||||
return env->NewStringUTF(hello.c_str());
|
|
||||||
}
|
|
||||||
0
taoyao-client-android/taoyao/mediasoup/.gitignore
vendored
Normal file
0
taoyao-client-android/taoyao/mediasoup/.gitignore
vendored
Normal file
76
taoyao-client-android/taoyao/mediasoup/CMakeLists.txt
Normal file
76
taoyao-client-android/taoyao/mediasoup/CMakeLists.txt
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
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
|
||||||
|
$<$<NOT:$<PLATFORM_ID:Windows>>:WEBRTC_POSIX>
|
||||||
|
$<$<PLATFORM_ID:Darwin>:WEBRTC_MAC>
|
||||||
|
$<$<PLATFORM_ID:Windows>:NOMINMAX>
|
||||||
|
$<$<PLATFORM_ID:Windows>:WEBRTC_WIN>
|
||||||
|
$<$<PLATFORM_ID:Windows>:WIN32_LEAN_AND_MEAN>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
${PROJECT_NAME} PUBLIC
|
||||||
|
log
|
||||||
|
android
|
||||||
|
OpenSLES
|
||||||
|
mediasoupclient
|
||||||
|
)
|
||||||
58
taoyao-client-android/taoyao/mediasoup/build.gradle
Normal file
58
taoyao-client-android/taoyao/mediasoup/build.gradle
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
}
|
||||||
|
|
||||||
|
def WEBRTC_INC_PATH = "${projectDir}/deps/webrtc/src"
|
||||||
|
def WEBRTC_LIB_PATH = "${projectDir}/deps/webrtc/lib"
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.acgist.mediasoup'
|
||||||
|
compileSdk 32
|
||||||
|
defaultConfig {
|
||||||
|
minSdk 31
|
||||||
|
targetSdk 32
|
||||||
|
versionCode 100
|
||||||
|
versionName "1.0.0"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
cFlags '-std=c17'
|
||||||
|
cppFlags '-std=c++17'
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path file('CMakeLists.txt')
|
||||||
|
version '3.22.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
}
|
||||||
BIN
taoyao-client-android/taoyao/mediasoup/libs/libwebrtc.jar
Normal file
BIN
taoyao-client-android/taoyao/mediasoup/libs/libwebrtc.jar
Normal file
Binary file not shown.
0
taoyao-client-android/taoyao/mediasoup/proguard-rules.pro
vendored
Normal file
0
taoyao-client-android/taoyao/mediasoup/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
</manifest>
|
||||||
18
taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.cpp
Normal file
18
taoyao-client-android/taoyao/mediasoup/src/main/cpp/main.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <jni.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "Device.hpp"
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
|
Java_com_acgist_taoyao_client_MainActivity_stringFromJNI(
|
||||||
|
JNIEnv* env,
|
||||||
|
jobject /* this */) {
|
||||||
|
mediasoupclient::Device device;
|
||||||
|
if(device.IsLoaded()) {
|
||||||
|
std::string hello = "Hello from C++ true";
|
||||||
|
return env->NewStringUTF(hello.c_str());
|
||||||
|
} else {
|
||||||
|
std::string hello = "Hello from C++ false";
|
||||||
|
return env->NewStringUTF(hello.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,3 +15,4 @@ dependencyResolutionManagement {
|
|||||||
rootProject.name = "taoyao"
|
rootProject.name = "taoyao"
|
||||||
include ':boot'
|
include ':boot'
|
||||||
include ':client'
|
include ':client'
|
||||||
|
include ':mediasoup'
|
||||||
|
|||||||
Reference in New Issue
Block a user