Skip to content

Commit

Permalink
Pre-release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
disa6302 committed Aug 8, 2023
2 parents 82ae3bf + b2b05c8 commit 19bd8b6
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 19 deletions.
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug,needs-triage
assignees: ''

---

**Logging**
Add relevent SDK logging. IMPORTANT NOTE: Please make sure to NOT share AWS access credentials under any circumstance! Please make sure they are not in the logs.

**Describe the bug**
A clear and concise description of what the bug is.

**SDK version number**
Include the SDK version you are running. If it is a specific commit on master branch, include that

**Open source building**
If it is a build issue, include 3rd party library version and steps to how you are building it

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.

18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/questions-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Questions/Help
about: Describe this issue template's purpose here.
title: "[QUESTION]"
labels: question,needs-triage
assignees: ''

---

A one liner description about the use case and what you are trying to achieve

** Logging **
Add relevent SDK logging. IMPORTANT NOTE: Please make sure to NOT share AWS access credentials under any circumstance! Please make sure they are not in the logs.

** Any design considerations/constraints **
Explain in detail how you would like to integrate our SDK into your solution

** If you would not like to open an issue to discuss your solution in open-platform, please email your question to [email protected] **
6 changes: 6 additions & 0 deletions .github/build_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" amd64
mkdir build
cd build
cmd.exe /c cmake -G "NMake Makefiles" ..
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE ..
nmake
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ jobs:
cmake .. -DCODE_COVERAGE=TRUE -DBUILD_TEST=TRUE
make
ulimit -c unlimited -S
- name: Run tests
run: |
cd build
timeout --signal=SIGABRT 60m ./tst/webrtc_client_test
- name: Code coverage
run: |
Expand Down
2 changes: 1 addition & 1 deletion CMake/Dependencies/libkvsCommonLws-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(ExternalProject)

ExternalProject_Add(libkvsCommonLws-download
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
GIT_TAG daf742a0a53f72341e5b2df75a05ebe6d2557811
GIT_TAG b0342a72346ec604f2a39a860fff0f7e8ae35914
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ These would be applicable if the SDK is being linked with system dependencies in

#### Cross-Compilation

If you wish to cross-compile `CC` and `CXX` are respected when building the library and all its dependencies. You will also need to set `BUILD_OPENSSL_PLATFORM`, `BUILD_LIBSRTP_HOST_PLATFORM` and `BUILD_LIBSRTP_DESTINATION_PLATFORM`. See our [.travis.yml](.travis.yml) for an example of this. Every commit is cross compiled to ensure that it continues to work.
If you wish to cross-compile `CC` and `CXX` are respected when building the library and all its dependencies. You will also need to set `BUILD_OPENSSL_PLATFORM`, `BUILD_LIBSRTP_HOST_PLATFORM` and `BUILD_LIBSRTP_DESTINATION_PLATFORM`. See our codecov.io for an example of this. Every commit is cross compiled to ensure that it continues to work.

#### Static Builds

Expand Down
30 changes: 29 additions & 1 deletion samples/Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,13 @@ STATUS initializePeerConnection(PSampleConfiguration pSampleConfiguration, PRtcP
configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_ALL;

// Set the STUN server
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, pSampleConfiguration->channelInfo.pRegion);
PCHAR pKinesisVideoStunUrlPostFix = KINESIS_VIDEO_STUN_URL_POSTFIX;
// If region is in CN, add CN region uri postfix
if (STRSTR(pSampleConfiguration->channelInfo.pRegion, "cn-")) {
pKinesisVideoStunUrlPostFix = KINESIS_VIDEO_STUN_URL_POSTFIX_CN;
}
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, pSampleConfiguration->channelInfo.pRegion,
pKinesisVideoStunUrlPostFix);

if (pSampleConfiguration->useTurn) {
// Set the URIs from the configuration
Expand Down Expand Up @@ -1118,6 +1124,28 @@ STATUS freeSampleConfiguration(PSampleConfiguration* ppSampleConfiguration)
timerQueueFree(&pSampleConfiguration->timerQueueHandle);
}

if (IS_VALID_TIMER_QUEUE_HANDLE(pSampleConfiguration->timerQueueHandle)) {
if (pSampleConfiguration->iceCandidatePairStatsTimerId != MAX_UINT32) {
retStatus = timerQueueCancelTimer(pSampleConfiguration->timerQueueHandle, pSampleConfiguration->iceCandidatePairStatsTimerId,
(UINT64) pSampleConfiguration);
if (STATUS_FAILED(retStatus)) {
DLOGE("Failed to cancel stats timer with: 0x%08x", retStatus);
}
pSampleConfiguration->iceCandidatePairStatsTimerId = MAX_UINT32;
}

if (pSampleConfiguration->pregenerateCertTimerId != MAX_UINT32) {
retStatus = timerQueueCancelTimer(pSampleConfiguration->timerQueueHandle, pSampleConfiguration->pregenerateCertTimerId,
(UINT64) pSampleConfiguration);
if (STATUS_FAILED(retStatus)) {
DLOGE("Failed to cancel certificate pre-generation timer with: 0x%08x", retStatus);
}
pSampleConfiguration->pregenerateCertTimerId = MAX_UINT32;
}

timerQueueFree(&pSampleConfiguration->timerQueueHandle);
}

if (pSampleConfiguration->pPendingSignalingMessageForRemoteClient != NULL) {
// Iterate and free all the pending queues
stackQueueGetIterator(pSampleConfiguration->pPendingSignalingMessageForRemoteClient, &iterator);
Expand Down
3 changes: 3 additions & 0 deletions samples/Samples.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ extern "C" {
// comment out this line to disable the feature
#define KVS_USE_SIGNALING_CHANNEL_THREADPOOL 1

#define MASTER_DATA_CHANNEL_MESSAGE "This message is from the KVS Master"
#define VIEWER_DATA_CHANNEL_MESSAGE "This message is from the KVS Viewer"

/* Uncomment the following line in order to enable IoT credentials checks in the provided samples */
// #define IOT_CORE_ENABLE_CREDENTIALS 1

Expand Down
14 changes: 14 additions & 0 deletions samples/kvsWebRTCClientMaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ INT32 main(INT32 argc, CHAR* argv[])
// Kick of the termination sequence
ATOMIC_STORE_BOOL(&pSampleConfiguration->appTerminateFlag, TRUE);

if (IS_VALID_MUTEX_VALUE(pSampleConfiguration->sampleConfigurationObjLock)) {
MUTEX_LOCK(pSampleConfiguration->sampleConfigurationObjLock);
}

// Cancel the media thread
if (pSampleConfiguration->mediaThreadStarted) {
DLOGD("Canceling media thread");
THREAD_CANCEL(pSampleConfiguration->mediaSenderTid);
}

if (IS_VALID_MUTEX_VALUE(pSampleConfiguration->sampleConfigurationObjLock)) {
MUTEX_UNLOCK(pSampleConfiguration->sampleConfigurationObjLock);
}

if (pSampleConfiguration->mediaSenderTid != INVALID_TID_VALUE) {
THREAD_JOIN(pSampleConfiguration->mediaSenderTid, NULL);
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/parse_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
print(example_sums) # {'STATUS_CHILD': "0x5", 'STATUS_PARENT': "0x4"}
'''

<<<<<<< HEAD
pattern = re.compile("#define *(STATUS\_[A-Z_]*) *(([A-Z_]*) *\+ *)?0x([0-9a-fA-F]*)")
=======
pattern = re.compile("#define *(STATUS\_[A-Z_]*) *(([A-Z_]*) *\+ *)?0x([0-9]*)")
>>>>>>> master

def operands_by_name(paragraph):
matches = filter(None, [pattern.match(line) for line in paragraph.splitlines()])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,9 @@ extern "C" {
/**
* Parameterized string for KVS STUN Server
*/
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.amazonaws.com:443"
#define KINESIS_VIDEO_STUN_URL_POSTFIX "amazonaws.com"
#define KINESIS_VIDEO_STUN_URL_POSTFIX_CN "amazonaws.com.cn"
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.%s:443"

/**
* Default signaling SSL port
Expand Down
1 change: 1 addition & 0 deletions src/source/Ice/IceAgent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,7 @@ STATUS incomingRelayedDataHandler(UINT64 customData, PSocketConnection pSocketCo

CHK(pRelayedCandidate != NULL && pSocketConnection != NULL, STATUS_NULL_ARG);

DLOGV("Candidate id: %s", pRelayedCandidate->id);
CHK_STATUS(turnConnectionIncomingDataHandler(pRelayedCandidate->pTurnConnection, pBuffer, bufferLen, pSrc, pDest, turnChannelData,
&turnChannelDataCount));
for (i = 0; i < turnChannelDataCount; ++i) {
Expand Down
4 changes: 4 additions & 0 deletions src/source/Signaling/ChannelInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ STATUS createValidateChannelInfo(PChannelInfo pOrigChannelInfo, PChannelInfo* pp
// Create a fully qualified URI
SNPRINTF(pCurPtr, MAX_CONTROL_PLANE_URI_CHAR_LEN, "%s%s.%s%s", CONTROL_PLANE_URI_PREFIX, KINESIS_VIDEO_SERVICE_NAME, pChannelInfo->pRegion,
CONTROL_PLANE_URI_POSTFIX);
// If region is in CN, add CN region uri postfix
if (STRSTR(pChannelInfo->pRegion, "cn-")) {
STRCAT(pCurPtr, ".cn");
}
}

pChannelInfo->pControlPlaneUrl = pCurPtr;
Expand Down
2 changes: 1 addition & 1 deletion src/source/Signaling/Client.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ STATUS createSignalingClientSync(PSignalingClientInfo pClientInfo, PChannelInfo
UINT64 signalingClientCreationWaitTime;
UINT64 startTime = 0;

DLOGI("Creating Signaling Client Sync");
DLOGV("Creating Signaling Client Sync");
CHK(pSignalingHandle != NULL && pClientInfo != NULL, STATUS_NULL_ARG);

// Convert the client info to the internal structure with empty values
Expand Down
1 change: 0 additions & 1 deletion src/source/Signaling/LwsApiCalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ INT32 lwsHttpCallbackRoutine(struct lws* wsi, enum lws_callback_reasons reason,
pLwsCallInfo->callInfo.callResult = SERVICE_CALL_SIGNATURE_NOT_YET_CURRENT;
}
}

} else {
DLOGV("Received client http read response: %s", pLwsCallInfo->callInfo.responseData);
}
Expand Down
2 changes: 2 additions & 0 deletions src/source/Signaling/Signaling.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ STATUS createSignalingSync(PSignalingClientInfoInternal pClientInfo, PChannelInf

pSignalingClient->version = SIGNALING_CLIENT_CURRENT_VERSION;

pSignalingClient->version = SIGNALING_CLIENT_CURRENT_VERSION;

// Set invalid call times
pSignalingClient->describeTime = INVALID_TIMESTAMP_VALUE;
pSignalingClient->createTime = INVALID_TIMESTAMP_VALUE;
Expand Down
4 changes: 2 additions & 2 deletions tst/PeerConnectionFunctionalityTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ TEST_F(PeerConnectionFunctionalityTest, sendDataWithClosedSocketConnectionWithHo
PSocketConnection pSocketConnection;

MEMSET(&configuration, 0x00, SIZEOF(RtcConfiguration));
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

EXPECT_EQ(createPeerConnection(&configuration, &offerPc), STATUS_SUCCESS);
EXPECT_EQ(createPeerConnection(&configuration, &answerPc), STATUS_SUCCESS);
Expand Down Expand Up @@ -524,7 +524,7 @@ TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersWithHostAndStun)
MEMSET(&configuration, 0x00, SIZEOF(RtcConfiguration));

// Set the STUN server
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

EXPECT_EQ(createPeerConnection(&configuration, &offerPc), STATUS_SUCCESS);
EXPECT_EQ(createPeerConnection(&configuration, &answerPc), STATUS_SUCCESS);
Expand Down
14 changes: 7 additions & 7 deletions tst/SdpApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ a=group:BUNDLE 0
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -667,7 +667,7 @@ a=group:BUNDLE audio video data
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, KINESIS_VIDEO_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -728,7 +728,7 @@ a=group:BUNDLE 0
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -786,7 +786,7 @@ a=group:BUNDLE 0
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -849,7 +849,7 @@ a=ice-options:trickle
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -1102,7 +1102,7 @@ a=ice-options:trickle
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, KINESIS_VIDEO_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down Expand Up @@ -1320,7 +1320,7 @@ a=ssrc:1644235696 cname:{36a6a74c-73a4-594b-9bb0-023b4d357280})";
RtcSessionDescriptionInit offerSdp{};
RtcSessionDescriptionInit answerSdp{};

SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, KINESIS_VIDEO_STUN_URL_POSTFIX);

track1.kind = MEDIA_STREAM_TRACK_KIND_VIDEO;
track1.codec = RTC_CODEC_VP8;
Expand Down
2 changes: 1 addition & 1 deletion tst/WebRTCClientTestFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void WebRtcClientTestBase::getIceServers(PRtcConfiguration pRtcConfiguration)
EXPECT_EQ(STATUS_SUCCESS, signalingClientGetIceConfigInfoCount(mSignalingClientHandle, &iceConfigCount));

// Set the STUN server
SNPRINTF(pRtcConfiguration->iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION);
SNPRINTF(pRtcConfiguration->iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, TEST_DEFAULT_REGION, TEST_DEFAULT_STUN_URL_POSTFIX);

for (uriCount = 0, i = 0; i < iceConfigCount; i++) {
EXPECT_EQ(STATUS_SUCCESS, signalingClientGetIceConfigInfo(mSignalingClientHandle, i, &pIceConfigInfo));
Expand Down
1 change: 1 addition & 0 deletions tst/WebRTCClientTestFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <atomic>

#define TEST_DEFAULT_REGION ((PCHAR) "us-west-2")
#define TEST_DEFAULT_STUN_URL_POSTFIX (KINESIS_VIDEO_STUN_URL_POSTFIX)
#define TEST_STREAMING_TOKEN_DURATION (40 * HUNDREDS_OF_NANOS_IN_A_SECOND)
#define TEST_JITTER_BUFFER_CLOCK_RATE (1000)
#define TEST_SIGNALING_MASTER_CLIENT_ID (PCHAR) "Test_Master_ClientId"
Expand Down

0 comments on commit 19bd8b6

Please sign in to comment.