Skip to content

Commit

Permalink
cleanup + rename
Browse files Browse the repository at this point in the history
  • Loading branch information
niyatim23 committed Sep 19, 2023
1 parent 69a9be7 commit 33b4b39
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 39 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ option(BUILD_LIBSRTP_HOST_PLATFORM "If buildng LibSRTP what is the current platf
option(BUILD_LIBSRTP_DESTINATION_PLATFORM "If buildng LibSRTP what is the destination platform" OFF)
option(BUILD_SAMPLE "Build available samples" ON)
option(ENABLE_DATA_CHANNEL "Enable support for data channel" ON)
option(ENABLE_KVS_SIGNALING_THREADPOOL "Enable support for KVS thread pool in signaling" ON)
option(ENABLE_KVS_THREADPOOL "Enable support for KVS thread pool in signaling" ON)
option(INSTRUMENTED_ALLOCATORS "Enable memory instrumentation" OFF)

# Developer Flags
Expand Down Expand Up @@ -99,8 +99,8 @@ message(STATUS "dependencies install path is ${OPEN_SRC_INSTALL_PREFIX}")
add_definitions(-DKVS_CA_CERT_PATH="${CMAKE_SOURCE_DIR}/certs/cert.pem")
add_definitions(-DCMAKE_DETECTED_CACERT_PATH)

if (ENABLE_KVS_SIGNALING_THREADPOOL)
add_definitions(-DENABLE_KVS_SIGNALING_THREADPOOL)
if (ENABLE_KVS_THREADPOOL)
add_definitions(-DENABLE_KVS_THREADPOOL)
endif()

if(USE_OPENSSL)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ To build on a 32-bit Raspbian GNU/Linux 11 on 64-bit hardware, the OpenSSL libra

### Threadpool for Signaling Channel messages
The threadpool is enabled by default, and starts with 3 threads that it can increase up to 5 if all 3 are actively in use. To change these values to better match the resources of your use case
please edit samples/Samples.h defines `KVS_SIGNALING_THREADPOOL_MIN` and `KVS_SIGNALING_THREADPOOL_MAX`. You can also disable the threadpool to instead create and detach each thread to handle signaling messages by disabling the flag `-DENABLE_KVS_SIGNALING_THREADPOOL` while building with cmake.
please edit samples/Samples.h defines `KVS_SIGNALING_THREADPOOL_MIN` and `KVS_SIGNALING_THREADPOOL_MAX`. You can also disable the threadpool to instead create and detach each thread to handle signaling messages by disabling the flag `-DENABLE_KVS_THREADPOOL` while building with cmake.

## Documentation
All Public APIs are documented in our [Include.h](https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/master/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h), we also generate a [Doxygen](https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/) each commit for easier navigation.
Expand Down
2 changes: 1 addition & 1 deletion src/source/Signaling/LwsApiCalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2011,7 +2011,7 @@ STATUS receiveLwsMessage(PSignalingClient pSignalingClient, PCHAR pMessage, UINT
DLOGW("Failed to validate the ICE server configuration received with an Offer");
}

#ifdef ENABLE_KVS_SIGNALING_THREADPOOL
#ifdef ENABLE_KVS_THREADPOOL
CHK_STATUS(threadpoolPush(pSignalingClient->pThreadpool, receiveLwsMessageWrapper, (PVOID) pSignalingMessageWrapper));
#else
// Issue the callback on a separate thread
Expand Down
4 changes: 2 additions & 2 deletions src/source/Signaling/Signaling.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ STATUS createSignalingSync(PSignalingClientInfoInternal pClientInfo, PChannelInf
CHK_STATUS(createValidateChannelInfo(pChannelInfo, &pSignalingClient->pChannelInfo));
CHK_STATUS(validateSignalingCallbacks(pSignalingClient, pCallbacks));
CHK_STATUS(validateSignalingClientInfo(pSignalingClient, pClientInfo));
#ifdef ENABLE_KVS_SIGNALING_THREADPOOL
#ifdef ENABLE_KVS_THREADPOOL
DLOGD("Going to crate the threadpool for signaling");
CHK_STATUS(threadpoolCreate(&pSignalingClient->pThreadpool, pClientInfo->signalingClientInfo.signalingMessagesMinimumThreads,
pClientInfo->signalingClientInfo.signalingMessagesMaximumThreads));
Expand Down Expand Up @@ -227,7 +227,7 @@ STATUS freeSignaling(PSignalingClient* ppSignalingClient)

hashTableFree(pSignalingClient->diagnostics.pEndpointToClockSkewHashMap);

#ifdef ENABLE_KVS_SIGNALING_THREADPOOL
#ifdef ENABLE_KVS_THREADPOOL
threadpoolFree(pSignalingClient->pThreadpool);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/source/Signaling/Signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ typedef struct {
UINT64 deleteTime;
UINT64 connectTime;

#ifdef ENABLE_KVS_SIGNALING_THREADPOOL
#ifdef ENABLE_KVS_THREADPOOL
PThreadpool pThreadpool;
#endif
UINT64 offerTime;
Expand Down
31 changes: 0 additions & 31 deletions tst/suppressions/TSAN.supp
Original file line number Diff line number Diff line change
Expand Up @@ -177,34 +177,3 @@ deadlock:com::amazonaws::kinesis::video::webrtcclient::DtlsFunctionalityTest::cr
deadlock:lwsListenerHandler
deadlock:connectSignalingChannelLws
race:lwsListenerHandler

# ==================
# WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (pid=17000)
# #0 pthread_mutex_unlock <null> (webrtc_client_test+0x4668f6)
# #1 defaultUnlockMutex <null> (libkvsWebrtcClient.so+0x9dd94)
#
# Location is heap block of size 48 at 0x7b0c00001a70 allocated by main thread:
# #0 calloc <null> (webrtc_client_test+0x447d50)
# #1 defaultMemCalloc <null> (libkvsWebrtcClient.so+0x99fdc)
# #2 createSignalingClientSync /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/src/source/Signaling/Client.c:83:21 (libkvsWebrtcSignalingClient.so+0xed0b)
# 2023-09-13 23:48:26.175 ERROR timerQueue
# #3 com::amazonaws::kinesis::video::webrtcclient::WebRtcClientTestBase::initializeSignalingClient(__AwsCredentialProvider*) /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/WebRTCClientTestFixture.h:127:21 (webrtc_client_test+0x53d564)
# #4 com::amazonaws::kinesis::video::webrtcclient::IceFunctionalityTest_IceAgentCandidateGatheringTest_Test::TestBody() /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/IceFunctionalityTest.cpp:665:5 (webrtc_client_test+0x53a313)
# #5 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (webrtc_client_test+0x767253)
# #6 main /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/main.cpp:68:14 (webrtc_client_test+0x714b55)
#
# Mutex M1128 (0x7b0c00001a78) created at:
# #0 pthread_mutex_init <null> (webrtc_client_test+0x44a91d)
# #1 defaultCreateMutex <null> (libkvsWebrtcClient.so+0x9dd05)
# #2 createSignalingClientSync /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/src/source/Signaling/Client.c:83:21 (libkvsWebrtcSignalingClient.so+0xed0b)
# #3 com::amazonaws::kinesis::video::webrtcclient::WebRtcClientTestBase::initializeSignalingClient(__AwsCredentialProvider*) /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/WebRTCClientTestFixture.h:127:21 (webrtc_client_test+0x53d564)
# #4 com::amazonaws::kinesis::video::webrtcclient::IceFunctionalityTest_IceAgentCandidateGatheringTest_Test::TestBody() /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/IceFunctionalityTest.cpp:665:5 (webrtc_client_test+0x53a313)
# #5 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) <null> (webrtc_client_test+0x767253)
# #6 main /home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/tst/main.cpp:68:14 (webrtc_client_test+0x714b55)
#
# SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (/home/runner/work/amazon-kinesis-video-streams-webrtc-sdk-c/amazon-kinesis-video-streams-webrtc-sdk-c/build/tst/webrtc_client_test+0x4668f6) in pthread_mutex_unlock
# ==================
# This is the expected behavior by the KVS Threadpool in pic
#mutex:lock
#deadlock:createSignalingSync
#deadlock:iceServerConfigRefreshConnectedAuthExpiration

0 comments on commit 33b4b39

Please sign in to comment.