Skip to content

Commit

Permalink
Merge branch 'develop' into twcc-resize
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanctech committed Mar 12, 2024
2 parents cf13ace + 55ac476 commit 4dfda81
Show file tree
Hide file tree
Showing 21 changed files with 588 additions and 325 deletions.
2 changes: 1 addition & 1 deletion .github/build_windows_openssl.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Buil
mkdir build
cd build
cmd.exe /c cmake -G "NMake Makefiles" ..
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE -DENABLE_AWS_SDK_IN_TESTS=OFF -DEXT_PTHREAD_INCLUDE_DIR="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/include/" -DEXT_PTHREAD_LIBRARIES="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/lib/x64/libpthreadGC2.a" ..
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE -DENABLE_AWS_SDK_IN_TESTS=OFF -DPKG_CONFIG_EXECUTABLE="D:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe" -DEXT_PTHREAD_INCLUDE_DIR="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/include/" -DEXT_PTHREAD_LIBRARIES="C:/tools/pthreads-w32-2-9-1-release/Pre-built.2/lib/x64/libpthreadGC2.a" ..
nmake
30 changes: 29 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,34 @@ jobs:
run: |
cd build
timeout --signal=SIGABRT 60m ./tst/webrtc_client_test
mbedtls-mac-os-build-clang:
runs-on: macos-latest
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
AWS_KVS_LOG_LEVEL: 2
permissions:
id-token: write
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Build repository
run: |
mkdir build && cd build
cmake .. -DBUILD_TEST=TRUE -DUSE_OPENSSL=OFF -DUSE_MBEDTLS=ON
make
- name: Run tests
run: |
cd build
./tst/webrtc_client_test
sample-check:
if: github.repository == 'awslabs/amazon-kinesis-video-streams-webrtc-sdk-c'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -580,7 +608,7 @@ jobs:
shell: powershell
run: |
$env:Path += ';C:\webrtc\open-source\bin;C:\tools\pthreads-w32-2-9-1-release\Pre-built.2\dll\x64;C:\webrtc\build'
& "C:\webrtc\build\tst\webrtc_client_test.exe" --gtest_filter="-DataChannelFunctionalityTest.*:DtlsApiTest.*:IceApiTest.*:IceFunctionalityTest.*:PeerConnectionFunctionalityTest.*:SignalingApiFunctionalityTest.*:TurnConnectionFunctionalityTest.*:RtpFunctionalityTest.marshallUnmarshallH264Data:RtpFunctionalityTest.packingUnpackingVerifySameH264Frame:RtcpFunctionalityTest.onRtcpPacketCompound:RtcpFunctionalityTest.twcc3"
& "C:\webrtc\build\tst\webrtc_client_test.exe" --gtest_filter="-SignalingApiFunctionalityTest.receivingIceConfigOffer_SlowClockSkew:SignalingApiFunctionalityTest.iceServerConfigRefreshConnectedAuthExpiration:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew:SignalingApiFunctionalityTest.receivingIceConfigOffer_FastClockSkew_VerifyOffsetRemovedWhenClockFixed:DataChannelFunctionalityTest.*:DtlsApiTest.*:IceApiTest.*:IceFunctionalityTest.*:PeerConnectionFunctionalityTest.*:TurnConnectionFunctionalityTest.*:RtpFunctionalityTest.marshallUnmarshallH264Data:RtpFunctionalityTest.packingUnpackingVerifySameH264Frame:RtcpFunctionalityTest.onRtcpPacketCompound:RtcpFunctionalityTest.twcc3"
# windows-msvc-mbedtls:
# runs-on: windows-2022
# env:
Expand Down
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "open-source/amazon-kinesis-video-streams-pic"]
path = open-source/amazon-kinesis-video-streams-pic
url = https://github.com/awslabs/amazon-kinesis-video-streams-pic.git
update = none
[submodule "open-source/amazon-kinesis-video-streams-producer-c"]
path = open-source/amazon-kinesis-video-streams-producer-c
url = https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
update = none
23 changes: 23 additions & 0 deletions CMake/Dependencies/libkvssdp-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.6.3)

project(libkvssdp NONE)

include(ExternalProject)
if (BUILD_STATIC_LIBS OR WIN32)
set(LIBKVSSDP_SHARED_LIBS OFF)
else()
set(LIBKVSSDP_SHARED_LIBS ON)
endif()

ExternalProject_Add(libkvssdp
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-sdp.git
GIT_TAG eca4928122c5cc0191d72cf1e87f54ffaddd017b
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DBUILD_SHARED_LIBS=${LIBKVSSDP_SHARED_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_ALWAYS TRUE
TEST_COMMAND ""
)
2 changes: 1 addition & 1 deletion CMake/Dependencies/libmbedtls-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ message(STATUS "C flags here are ${CMAKE_C_FLAGS}")
ExternalProject_Add(
project_libmbedtls
GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git
GIT_TAG v2.25.0
GIT_TAG v2.28.5
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
Expand Down
3 changes: 2 additions & 1 deletion CMake/Utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function(build_dependency lib_name)
curl
mbedtls
kvspic
kvsCommonLws)
kvsCommonLws
kvssdp)
list(FIND supported_libs ${lib_name} index)
if(${index} EQUAL -1)
message(WARNING "${lib_name} is not supported to build from source")
Expand Down
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,21 @@ if(BUILD_DEPENDENCIES)

build_dependency(srtp ${BUILD_ARGS})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/configs")
set(BUILD_ARGS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})

build_dependency(kvssdp ${BUILD_ARGS})

set(BUILD_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS})

build_dependency(usrsctp ${BUILD_ARGS})


if(BUILD_TEST)
build_dependency(gtest)

Expand Down Expand Up @@ -366,10 +375,11 @@ endif()

file(GLOB WEBRTC_SIGNALING_CLIENT_SOURCE_FILES "src/source/Signaling/*.c")


include_directories(${OPEN_SRC_INCLUDE_DIRS})
include_directories(${OPEN_SRC_INSTALL_PREFIX}/include)
include_directories(${KINESIS_VIDEO_WEBRTC_CLIENT_SRC}/src/include)
# include sdp_config.h
include_directories(src/source/Sdp/kvssdp)

add_library(kvsWebrtcClient ${LINKAGE} ${WEBRTC_CLIENT_SOURCE_FILES} ${DATACHANNEL_SRC})

Expand All @@ -388,6 +398,7 @@ target_link_libraries(
kvsWebrtcClient
PRIVATE kvspicUtils
kvspicState
kvssdp
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_SSL_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY}
Expand All @@ -408,7 +419,8 @@ target_link_libraries(
kvsWebrtcSignalingClient
PUBLIC
kvsCommonLws
${LIBWEBSOCKETS_LIBRARIES}
${LIBWEBSOCKETS_LIBRARIES}
kvssdp
PRIVATE kvspicUtils
kvspicState
${CMAKE_THREAD_LIBS_INIT}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ reported the issue. Please try to include as much information as you can. Detail
## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the *master* branch.
1. You are working against the latest source on the *develop* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.

Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,19 @@ Please refer to the release notes in [Releases](https://github.com/awslabs/amazo
### Download
To download run the following command:

`git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git`
```shell
git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c.git
```

You will also need to install `pkg-config` and `CMake` and a build environment

### Configuring on Ubuntu / Unix

Create a build directory in the newly checked out repository, and execute CMake from it.

`mkdir -p amazon-kinesis-video-streams-webrtc-sdk-c/build; cd amazon-kinesis-video-streams-webrtc-sdk-c/build; cmake .. `
```shell
mkdir -p amazon-kinesis-video-streams-webrtc-sdk-c/build; cd amazon-kinesis-video-streams-webrtc-sdk-c/build; cmake ..
```

We have provided an example of using GStreamer to capture/encode video, and then send via this library. This is only built if `pkg-config` finds
GStreamer is installed on your system.
Expand Down Expand Up @@ -151,6 +155,7 @@ You can pass the following options to `cmake ..`.
* `-DUNDEFINED_BEHAVIOR_SANITIZER` -- Build with UndefinedBehaviorSanitizer
* `-DCMAKE_BUILD_TYPE` -- Build Release/Debug libraries. By default, the SDK generates Release build. The standard options are listed [here](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations)
* `-DLINK_PROFILER` -- Link with gperftools (available profiler options are listed [here](https://github.com/gperftools/gperftools))
* `-DPKG_CONFIG_EXECUTABLE` -- Set pkg config path. This might be required to find gstreamer's pkg config specifically on Windows.

To clean up the `open-source` and `build` folders from previous build, use `cmake --build . --target clean` from the `build` folder

Expand Down Expand Up @@ -425,6 +430,19 @@ Similar to the heap profile, you only need to specify the following environment

More information about what environment variables you can configure can be found [here](https://gperftools.github.io/gperftools/cpuprofile.html)

### WebRTC Network Compatibility Checker

This program allows you to understand the network compatibility for WebRTC usage. By providing necessary parameters, it detects NAT behavior and filtering behavior and tells you if you can work with a particular STUN server or not. By default, it uses the STUN server from your environment variable `AWS_DEFAULT_REGION` if present. If not, it uses the STUN server from `us-west-2`.
#### How to Use

1. **Parameters**:
- `-i network-interface-name`: Specify the network interface name.
- `-s stun-hostname`: Specify the STUN server hostname.

2. **Example**:
```bash
./discoverNatBehavior -i eth0 -s stun.example.com

### Filtering network interfaces

This is useful to reduce candidate gathering time when it is known for certain network interfaces to not work well. A sample callback is available in `Common.c`. The `iceSetInterfaceFilterFunc` in `KvsRtcConfiguration` must be set to the required callback. In the sample, it can be done this way in `initializePeerConnection()`:
Expand Down
25 changes: 25 additions & 0 deletions configs/sdp_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Session Description Protocol Configuration
//

#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP_CONFIG__
#define __KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP_CONFIG__

#include <inttypes.h>

/**
* @brief SDP print format for uint64_t.
*/
#define SDP_PRINT_FMT_UINT64 PRIu64

/**
* @brief SDP print format for uint32_t.
*/
#define SDP_PRINT_FMT_UINT32 PRIu32

/**
* @brief SDP print format for uint16_t.
*/
#define SDP_PRINT_FMT_UINT16 "hu"

#endif //__KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP_CONFIG__
22 changes: 16 additions & 6 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ find_package(PkgConfig REQUIRED)

pkg_check_modules(GST gstreamer-1.0)
if(GST_FOUND)

if (WIN32)
if(NOT DEFINED PKG_CONFIG_EXECUTABLE)
if(EXISTS "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe")
set(PKG_CONFIG_EXECUTABLE "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe")
endif()
elseif(DEFINED PKG_CONFIG_EXECUTABLE)
message(STATUS "Gstreamer pkg-config path set to ${PKG_CONFIG_EXECUTABLE}")
else()
message(FATAL_ERROR "Gstreamer not found in default path. Set the appropriate path with -DPKG_CONFIG_EXECUTABLE=<path>")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig")
find_library(Intl "intl" REQUIRED PATHS "/usr/local/opt/gettext/lib")
Expand Down Expand Up @@ -49,26 +59,26 @@ add_executable(
kvsWebrtcClientMaster
Common.c
kvsWebRTCClientMaster.c)
target_link_libraries(kvsWebrtcClientMaster kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} kvsCommonLws kvspicUtils websockets)
target_link_libraries(kvsWebrtcClientMaster kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} kvsCommonLws kvspicUtils websockets kvssdp)

add_executable(
kvsWebrtcClientViewer
Common.c
kvsWebRTCClientViewer.c)
target_link_libraries(kvsWebrtcClientViewer kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} kvsCommonLws kvspicUtils websockets)
target_link_libraries(kvsWebrtcClientViewer kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} kvsCommonLws kvspicUtils websockets kvssdp)

add_executable(
discoverNatBehavior
discoverNatBehavior.c)
target_link_libraries(discoverNatBehavior kvsWebrtcClient ${EXTRA_DEPS})
target_link_libraries(discoverNatBehavior kvsWebrtcClient ${EXTRA_DEPS} kvssdp)

if(GST_FOUND)
add_executable(
kvsWebrtcClientMasterGstSample
Common.c
kvsWebrtcClientMasterGstSample.c
kvsWebRTCClientMasterGstSample.c
)
target_link_libraries(kvsWebrtcClientMasterGstSample kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} ${GST_SAMPLE_LIBRARIES} kvsCommonLws kvspicUtils websockets)
target_link_libraries(kvsWebrtcClientMasterGstSample kvsWebrtcClient kvsWebrtcSignalingClient ${EXTRA_DEPS} ${GST_SAMPLE_LIBRARIES} kvsCommonLws kvspicUtils websockets kvssdp)

install(TARGETS kvsWebrtcClientMasterGstSample
RUNTIME DESTINATION bin
Expand Down
Loading

0 comments on commit 4dfda81

Please sign in to comment.