Skip to content

Adding more functionalities currently unimplemented in Java bindings #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,52 @@

Java native interface implementation based on the free, open [WebRTC](https://webrtc.org) project. The goal of this project is to enable development of RTC applications for desktop platforms running Java. This project wraps the [WebRTC Native API](https://webrtc.github.io/webrtc-org/native-code/native-apis) and is similar to the [JS API](https://w3c.github.io/webrtc-pc).

### Repository

```xml
<repository>
<id>singlerrrepo</id>
<url>https://github.com/singlerr/mvn-repo/raw/maven2/</url>
</repository>
```

### Maven

```xml
<dependency>
<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java</artifactId>
<version>0.9.0</version>
<version>0.11.0-SNAPSHOT</version>
</dependency>
```

### Gradle

```groovy
implementation "dev.onvoid.webrtc:webrtc-java:0.9.0"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "windows-x86_64"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "macos-x86_64"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "macos-aarch64"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "linux-x86_64"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "linux-aarch64"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.9.0", classifier: "linux-aarch32"
implementation "dev.onvoid.webrtc:webrtc-java:0.11.0-SNAPSHOT"
implementation group: "dev.onvoid.webrtc", name: "webrtc-java", version: "0.11.0-SNAPSHOT", classifier: "windows-x86_64"
```

### Supported Platforms
Maven Central artifacts contain native libraries that can be loaded on the following platforms:

<table>
<tr>
<td>Linux</td>
<td>x86_64, arm64, arm32</td>
</tr>
<tr>
<td>macOS</td>
<td>x86_64, arm64</td>
</tr>

[//]: # ( <tr>)

[//]: # ( <td>Linux</td>)

[//]: # ( <td>x86_64, arm64, arm32</td>)

[//]: # ( </tr>)

[//]: # ( <tr>)

[//]: # ( <td>macOS</td>)

[//]: # ( <td>x86_64, arm64</td>)

[//]: # ( </tr>)
<tr>
<td>Windows</td>
<td>x86_64</td>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java-parent</artifactId>
<version>0.10.0-SNAPSHOT</version>
<version>0.11.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>webrtc-java-parent</name>
Expand Down
12 changes: 8 additions & 4 deletions webrtc-jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
<parent>
<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java-parent</artifactId>
<version>0.10.0-SNAPSHOT</version>
<version>0.11.0-SNAPSHOT</version>
</parent>

<artifactId>webrtc-java-jni</artifactId>
<packaging>pom</packaging>

<properties>
<webrtc.branch>branch-heads/4844</webrtc.branch>
<webrtc.src.dir>${user.home}/webrtc</webrtc.src.dir>
<webrtc.install.dir>${user.home}/webrtc/build</webrtc.install.dir>
<webrtc.src.dir>${project.build.directory}/webrtcbuild/webrtc</webrtc.src.dir>
<webrtc.install.dir>${project.build.directory}/webrtcbuild/build</webrtc.install.dir>
<cmake.build.type>Release</cmake.build.type>
<cmake.toolchain.file />
<vcpkg.target.triplet>x64-windows-static</vcpkg.target.triplet>
<cmake.toolchain.file>C:/vcpkg/scripts/buildsystems/vcpkg.cmake</cmake.toolchain.file>
</properties>

<build>
Expand Down Expand Up @@ -113,6 +114,9 @@
<option>
-DCMAKE_INSTALL_PREFIX=${project.build.directory}/lib
</option>
<option>
-DVCPKG_TARGET_TRIPLET=${vcpkg.target.triplet}
</option>
</options>
</configuration>
</execution>
Expand Down
2 changes: 2 additions & 0 deletions webrtc-jni/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif()

add_subdirectory(dependencies/webrtc)
add_subdirectory(dependencies/jni-voithos)
add_subdirectory(dependencies/ffmpeg)

file(GLOB SOURCES_ROOT "src/*.cpp")
file(GLOB SOURCES_API "src/api/*.cpp")
Expand Down Expand Up @@ -72,6 +73,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES

target_link_libraries(${PROJECT_NAME} jni-voithos)
target_link_libraries(${PROJECT_NAME} webrtc)
target_link_libraries(${PROJECT_NAME} ffmpeg)

if(APPLE)
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS "-x objective-c++")
Expand Down
23 changes: 23 additions & 0 deletions webrtc-jni/src/main/cpp/dependencies/ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.13)
project(ffmpeg)

FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pseudo.hxx
"template<class T> class pseudo{}\n")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pseudo.cxx
"static void pseudo(void){}\n")


add_library(${PROJECT_NAME} STATIC pseudo.cxx pseudo.hxx)

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
target_compile_definitions(${PROJECT_NAME} PUBLIC FFMPEG_STATIC_DEFINE)

find_package(FFMPEG REQUIRED)

target_include_directories(${PROJECT_NAME} PUBLIC ${FFMPEG_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PUBLIC ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${FFMPEG_LIBRARIES})
12 changes: 9 additions & 3 deletions webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,18 @@ set(WEBRTC_SRC ${WEBRTC_DIR}/src)
set(WEBRTC_BUILD out/${TARGET_CPU})
set(WEBRTC_LIB_PATH ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/${WEBRTC_LIB})
set(WEBRTC_LIB_PATH_INSTALLED ${WEBRTC_INSTALL_DIR}/lib/${WEBRTC_LIB})
set(FFMPEG_LIB_PATH ${WEBRTC_SRC}/${WEBRTC_BUILD}/obj/third_party/ffmpeg/ffmpeg_internal.lib)
set(FFMPEG_LIB_PATH_INSTALLED ${WEBRTC_INSTALL_DIR}/lib/ffmpeg_internal.lib)


file(TO_CMAKE_PATH "${WEBRTC_DIR}" WEBRTC_DIR)
file(TO_CMAKE_PATH "${WEBRTC_INSTALL_DIR}" WEBRTC_INSTALL_DIR)
file(TO_CMAKE_PATH "${WEBRTC_LIB_PATH}" WEBRTC_LIB_PATH)

file(TO_CMAKE_PATH "${WEBRTC_LIB_PATH_INSTALLED}" WEBRTC_LIB_PATH_INSTALLED)

message(STATUS "WebRTC checkout path: ${WEBRTC_DIR}")
message(STATUS "WebRTC checkout branch: ${WEBRTC_BRANCH}")
message(STATUS "WebRTC heckout branch: ${WEBRTC_BRANCH}")
message(STATUS "WebRTC target: ${SOURCE_TARGET} ${TARGET_CPU}")
message(STATUS "WebRTC build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "WebRTC install path: ${WEBRTC_INSTALL_DIR}")
Expand Down Expand Up @@ -166,7 +170,7 @@ elseif(WIN32)
endif()

if(EXISTS "${WEBRTC_LIB_PATH}" OR EXISTS "${WEBRTC_LIB_PATH_INSTALLED}")
message(STATUS "WebRTC: Compiled version found '${TARGET_LINK_LIB}'")
message(STATUS "WebRTC: Compiled version found '${WEBRTC_LIB_PATH_INSTALLED}'")

if(LINUX)
sysroot_install()
Expand Down Expand Up @@ -237,12 +241,14 @@ if (PATCHES)
endif()

message(STATUS "WebRTC: generate")
set(COMPILE_ARGS "is_debug=false target_cpu=\"${TARGET_CPU}\" treat_warnings_as_errors=false rtc_build_examples=false rtc_include_tests=false use_rtti=true use_custom_libcxx=false symbol_level=0 rtc_use_h264=true")
set(COMPILE_ARGS "is_debug=false target_cpu=\"${TARGET_CPU}\" treat_warnings_as_errors=false rtc_build_examples=false rtc_include_tests=false use_rtti=true use_custom_libcxx=false symbol_level=0 rtc_use_h264=false")
execute_command(
COMMAND gn gen ${WEBRTC_BUILD} --args=${COMPILE_ARGS}
WORKING_DIRECTORY "${WEBRTC_SRC}"
)

message(STATUS "gn gen ${WEBRTC_BUILD} --args=${COMPILE_ARGS}")

message(STATUS "WebRTC: compile")
execute_command(
COMMAND ninja -C "${WEBRTC_BUILD}"
Expand Down
30 changes: 30 additions & 0 deletions webrtc-jni/src/main/cpp/include/JNI_AudioDecoderFactory.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions webrtc-jni/src/main/cpp/include/JNI_AudioDeviceModule.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions webrtc-jni/src/main/cpp/include/JNI_AudioEncoderFactory.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions webrtc-jni/src/main/cpp/include/JNI_AudioProcessing.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 29 additions & 21 deletions webrtc-jni/src/main/cpp/include/JNI_AudioTrack.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading