Skip to content

Commit

Permalink
Add SDP component as submodule after re-factoring (#1913)
Browse files Browse the repository at this point in the history
* Add SDP component as submodule after re-factoring
  • Loading branch information
ActoryOu authored Mar 5, 2024
1 parent 2f909bc commit 0e56515
Show file tree
Hide file tree
Showing 12 changed files with 433 additions and 239 deletions.
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 ""
)
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
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__
8 changes: 4 additions & 4 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,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
)
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
49 changes: 33 additions & 16 deletions src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,39 @@ extern "C" {
* (0x56000000)
* @{
*/
#define STATUS_SDP_BASE STATUS_WEBRTC_BASE + 0x01000000
#define STATUS_SDP_MISSING_ITEMS STATUS_SDP_BASE + 0x00000001
#define STATUS_SDP_ATTRIBUTES_ERROR STATUS_SDP_BASE + 0x00000002
#define STATUS_SDP_BANDWIDTH_ERROR STATUS_SDP_BASE + 0x00000003
#define STATUS_SDP_CONNECTION_INFORMATION_ERROR STATUS_SDP_BASE + 0x00000004
#define STATUS_SDP_EMAIL_ADDRESS_ERROR STATUS_SDP_BASE + 0x00000005
#define STATUS_SDP_ENCYRPTION_KEY_ERROR STATUS_SDP_BASE + 0x00000006
#define STATUS_SDP_INFORMATION_ERROR STATUS_SDP_BASE + 0x00000007
#define STATUS_SDP_MEDIA_NAME_ERROR STATUS_SDP_BASE + 0x00000008
#define STATUS_SDP_ORIGIN_ERROR STATUS_SDP_BASE + 0x00000009
#define STATUS_SDP_PHONE_NUMBER_ERROR STATUS_SDP_BASE + 0x0000000A
#define STATUS_SDP_TIME_DECRYPTION_ERROR STATUS_SDP_BASE + 0x0000000B
#define STATUS_SDP_TIMEZONE_ERROR STATUS_SDP_BASE + 0x0000000C
#define STATUS_SDP_URI_ERROR STATUS_SDP_BASE + 0x0000000D
#define STATUS_SDP_VERSION_ERROR STATUS_SDP_BASE + 0x0000000E
#define STATUS_SDP_ATTRIBUTE_MAX_EXCEEDED STATUS_SDP_BASE + 0x0000000F
#define STATUS_SDP_BASE STATUS_WEBRTC_BASE + 0x01000000
#define STATUS_SDP_MISSING_ITEMS STATUS_SDP_BASE + 0x00000001
#define STATUS_SDP_ATTRIBUTES_ERROR STATUS_SDP_BASE + 0x00000002
#define STATUS_SDP_BANDWIDTH_ERROR STATUS_SDP_BASE + 0x00000003
#define STATUS_SDP_CONNECTION_INFORMATION_ERROR STATUS_SDP_BASE + 0x00000004
#define STATUS_SDP_EMAIL_ADDRESS_ERROR STATUS_SDP_BASE + 0x00000005
#define STATUS_SDP_ENCYRPTION_KEY_ERROR STATUS_SDP_BASE + 0x00000006
#define STATUS_SDP_INFORMATION_ERROR STATUS_SDP_BASE + 0x00000007
#define STATUS_SDP_MEDIA_NAME_ERROR STATUS_SDP_BASE + 0x00000008
#define STATUS_SDP_ORIGIN_ERROR STATUS_SDP_BASE + 0x00000009
#define STATUS_SDP_PHONE_NUMBER_ERROR STATUS_SDP_BASE + 0x0000000A
#define STATUS_SDP_TIME_DECRYPTION_ERROR STATUS_SDP_BASE + 0x0000000B
#define STATUS_SDP_TIMEZONE_ERROR STATUS_SDP_BASE + 0x0000000C
#define STATUS_SDP_URI_ERROR STATUS_SDP_BASE + 0x0000000D
#define STATUS_SDP_VERSION_ERROR STATUS_SDP_BASE + 0x0000000E
#define STATUS_SDP_ATTRIBUTE_MAX_EXCEEDED STATUS_SDP_BASE + 0x0000000F
#define STATUS_SDP_MESSAGE_MALFORMED STATUS_SDP_BASE + 0x00000010
#define STATUS_SDP_MESSAGE_MALFORMED_NOT_ENOUGH_INFO STATUS_SDP_BASE + 0x00000011
#define STATUS_SDP_MESSAGE_MALFORMED_EQUAL_NOT_FOUND STATUS_SDP_BASE + 0x00000012
#define STATUS_SDP_MESSAGE_MALFORMED_NEWLINE_NOT_FOUND STATUS_SDP_BASE + 0x00000013
#define STATUS_SDP_MESSAGE_MALFORMED_NO_VALUE STATUS_SDP_BASE + 0x00000014
#define STATUS_SDP_MESSAGE_MALFORMED_NO_SESSION_ID STATUS_SDP_BASE + 0x00000015
#define STATUS_SDP_MESSAGE_MALFORMED_NO_SESSION_VERSION STATUS_SDP_BASE + 0x00000016
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_NETWORK_TYPE STATUS_SDP_BASE + 0x00000017
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_ADDRESS_TYPE STATUS_SDP_BASE + 0x00000018
#define STATUS_SDP_MESSAGE_MALFORMED_REDUNDANT_INFO STATUS_SDP_BASE + 0x00000019
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_BANDWIDTH STATUS_SDP_BASE + 0x0000001A
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_START_TIME STATUS_SDP_BASE + 0x0000001B
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_STOP_TIME STATUS_SDP_BASE + 0x0000001C
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_PORT STATUS_SDP_BASE + 0x0000001D
#define STATUS_SDP_MESSAGE_MALFORMED_INVALID_PORTNUM STATUS_SDP_BASE + 0x0000001E
#define STATUS_SDP_SNPRINTF_ERROR STATUS_SDP_BASE + 0x0000001F
#define STATUS_SDP_UNKNOWN_ERROR STATUS_SDP_BASE + 0x00000020
/*!@} */

/////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit 0e56515

Please sign in to comment.