From 2910cf314d3f75a2f0a1b5dc817f5af2edf41663 Mon Sep 17 00:00:00 2001 From: Niyati Maheshwari Date: Mon, 26 Feb 2024 16:08:03 -0800 Subject: [PATCH] Fix signaling cache and GStreamer sample build on Windows (#1935) * fix readFile signaling cache windows * fix branch name * enable signaling api functionality tests on windows ci * try install zlib * zlib condition cmake * fix file cachine tests on Windows +Gstreamer sample build * filter failing signaling tests on Windows * dummy commit * strnlen * cleanup --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 4 +++- samples/CMakeLists.txt | 8 ++++++++ src/source/Signaling/FileCache.c | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1da9a704dd..7f319ef58c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -580,7 +580,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: diff --git a/CMakeLists.txt b/CMakeLists.txt index a867d719c6..cd42455a47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -449,7 +449,9 @@ endif() if(BUILD_TEST) # adding ZLIB because aws sdk static link seems to be broken when zlib is needed - find_package(ZLIB REQUIRED) + if(NOT WIN32) + find_package(ZLIB REQUIRED) + endif() add_subdirectory(tst) endif() diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 1380c434b2..8b290c5a41 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -6,6 +6,14 @@ project(KinesisVideoWebRTCClientSamples LANGUAGES C) message("OPEN_SRC_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}") +if (WIN32) + 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") + else() + set(PKG_CONFIG_EXECUTABLE "D:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe") + endif() + endif() + find_package(PkgConfig REQUIRED) pkg_check_modules(GST gstreamer-1.0) diff --git a/src/source/Signaling/FileCache.c b/src/source/Signaling/FileCache.c index 3f69fb9296..bf79456276 100644 --- a/src/source/Signaling/FileCache.c +++ b/src/source/Signaling/FileCache.c @@ -38,7 +38,8 @@ STATUS deserializeSignalingCacheEntries(PCHAR cachedFileContent, UINT64 fileSize pCurrent = cachedFileContent; remainingSize = (UINT32) fileSize; /* detect end of file */ - while (remainingSize > MAX_SIGNALING_CACHE_ENTRY_TIMESTAMP_STR_LEN) { + while (STRNLEN(pCurrent, MAX_SERIALIZED_SIGNALING_CACHE_ENTRY_LEN * MAX_SIGNALING_CACHE_ENTRY_COUNT) > 0 && + remainingSize > MAX_SIGNALING_CACHE_ENTRY_TIMESTAMP_STR_LEN) { nextLine = STRCHR(pCurrent, '\n'); while ((nextToken = STRCHR(pCurrent, ',')) != NULL && nextToken < nextLine) { switch (tokenCount % 10) {