diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..1ed5fb63b4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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. + diff --git a/.github/ISSUE_TEMPLATE/questions-help.md b/.github/ISSUE_TEMPLATE/questions-help.md new file mode 100644 index 0000000000..83d1501847 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/questions-help.md @@ -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 kinesis-video-support@amazon.com ** diff --git a/.github/build_windows.bat b/.github/build_windows.bat new file mode 100644 index 0000000000..66fc5f2093 --- /dev/null +++ b/.github/build_windows.bat @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 924372389c..6322915014 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | diff --git a/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt b/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt index 1c3ff91c1f..c6223bb606 100644 --- a/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt +++ b/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt @@ -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} diff --git a/README.md b/README.md index 2677a3271b..731dd552fe 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/samples/Common.c b/samples/Common.c index 76862d1bff..5df16debf6 100644 --- a/samples/Common.c +++ b/samples/Common.c @@ -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 @@ -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); diff --git a/samples/Samples.h b/samples/Samples.h index dedd53d65e..0d79673f86 100644 --- a/samples/Samples.h +++ b/samples/Samples.h @@ -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 diff --git a/samples/kvsWebRTCClientMaster.c b/samples/kvsWebRTCClientMaster.c index 1913401f18..4f5cfd1c15 100644 --- a/samples/kvsWebRTCClientMaster.c +++ b/samples/kvsWebRTCClientMaster.c @@ -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); } diff --git a/scripts/parse_status.py b/scripts/parse_status.py index 5114b8c781..e32bed8e2c 100755 --- a/scripts/parse_status.py +++ b/scripts/parse_status.py @@ -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()]) diff --git a/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h b/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h index 943a355236..973b59984d 100644 --- a/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h +++ b/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h @@ -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 diff --git a/src/source/Ice/IceAgent.c b/src/source/Ice/IceAgent.c index 700f81b08f..2eaa49a2b1 100644 --- a/src/source/Ice/IceAgent.c +++ b/src/source/Ice/IceAgent.c @@ -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) { diff --git a/src/source/Signaling/ChannelInfo.c b/src/source/Signaling/ChannelInfo.c index 17cf3e4bfe..6f8dcaf560 100644 --- a/src/source/Signaling/ChannelInfo.c +++ b/src/source/Signaling/ChannelInfo.c @@ -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; diff --git a/src/source/Signaling/Client.c b/src/source/Signaling/Client.c index 425edcabf0..0ffc924d56 100644 --- a/src/source/Signaling/Client.c +++ b/src/source/Signaling/Client.c @@ -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 diff --git a/src/source/Signaling/LwsApiCalls.c b/src/source/Signaling/LwsApiCalls.c index 76d195fa35..18367e884d 100644 --- a/src/source/Signaling/LwsApiCalls.c +++ b/src/source/Signaling/LwsApiCalls.c @@ -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); } diff --git a/src/source/Signaling/Signaling.c b/src/source/Signaling/Signaling.c index c1fdd662d1..2c226b3a3f 100644 --- a/src/source/Signaling/Signaling.c +++ b/src/source/Signaling/Signaling.c @@ -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; diff --git a/tst/PeerConnectionFunctionalityTest.cpp b/tst/PeerConnectionFunctionalityTest.cpp index 955d0a25af..5a5e3ed3d5 100644 --- a/tst/PeerConnectionFunctionalityTest.cpp +++ b/tst/PeerConnectionFunctionalityTest.cpp @@ -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); @@ -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); diff --git a/tst/SdpApiTest.cpp b/tst/SdpApiTest.cpp index f1e651f2dd..ccc0fa4599 100644 --- a/tst/SdpApiTest.cpp +++ b/tst/SdpApiTest.cpp @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/tst/WebRTCClientTestFixture.cpp b/tst/WebRTCClientTestFixture.cpp index 8291bcf6de..d041db728e 100644 --- a/tst/WebRTCClientTestFixture.cpp +++ b/tst/WebRTCClientTestFixture.cpp @@ -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)); diff --git a/tst/WebRTCClientTestFixture.h b/tst/WebRTCClientTestFixture.h index 28a0686521..f4abf4532e 100644 --- a/tst/WebRTCClientTestFixture.h +++ b/tst/WebRTCClientTestFixture.h @@ -8,6 +8,7 @@ #include #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"