Skip to content

Commit f107343

Browse files
authored
Viewer fix (#1953)
* Viewer fix * ICE agent update * new flag * stopgathering flag set * Windows fix
1 parent 1eaede8 commit f107343

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ jobs:
552552
- name: Install dependencies
553553
shell: powershell
554554
run: |
555-
choco install gstreamer --version=1.16.2
556-
choco install gstreamer-devel --version=1.16.2
555+
choco install gstreamer --version=1.16.3
556+
choco install gstreamer-devel --version=1.16.3
557557
curl.exe -o C:\tools\pthreads-w32-2-9-1-release.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
558558
mkdir C:\tools\pthreads-w32-2-9-1-release\
559559
Expand-Archive -Path C:\tools\pthreads-w32-2-9-1-release.zip -DestinationPath C:\tools\pthreads-w32-2-9-1-release

CMakeLists.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ include(CheckIncludeFiles)
55
include(CheckFunctionExists)
66

77
# The version MUST be updated before every release
8-
project(KinesisVideoWebRTCClient VERSION 1.10.0 LANGUAGES C)
9-
10-
11-
8+
project(KinesisVideoWebRTCClient VERSION 1.10.1 LANGUAGES C)
129

1310
# User Flags
1411
option(ADD_MUCLIBC "Add -muclibc c flag" OFF)

src/source/Ice/IceAgent.c

+15-10
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ STATUS createIceAgent(PCHAR username, PCHAR password, PIceAgentCallbacks pIceAge
4343

4444
ATOMIC_STORE_BOOL(&pIceAgent->remoteCredentialReceived, FALSE);
4545
ATOMIC_STORE_BOOL(&pIceAgent->agentStartGathering, FALSE);
46+
ATOMIC_STORE_BOOL(&pIceAgent->stopGathering, FALSE);
4647
ATOMIC_STORE_BOOL(&pIceAgent->candidateGatheringFinished, FALSE);
4748
ATOMIC_STORE_BOOL(&pIceAgent->shutdown, FALSE);
4849
ATOMIC_STORE_BOOL(&pIceAgent->restart, FALSE);
4950
ATOMIC_STORE_BOOL(&pIceAgent->processStun, TRUE);
51+
ATOMIC_STORE_BOOL(&pIceAgent->addedRelayCandidate, FALSE);
5052
pIceAgent->isControlling = FALSE;
5153
pIceAgent->tieBreaker = (UINT64) RAND();
5254
pIceAgent->iceTransportPolicy = pRtcConfiguration->iceTransportPolicy;
@@ -327,7 +329,7 @@ STATUS iceAgentAddConfig(PIceAgent pIceAgent, PIceConfigInfo pIceConfigInfo)
327329
DLOGE("Failed to parse ICE servers");
328330
}
329331
}
330-
332+
ATOMIC_STORE_BOOL(&pIceAgent->addedRelayCandidate, TRUE);
331333
CleanUp:
332334
CHK_LOG_ERR(retStatus);
333335

@@ -382,7 +384,6 @@ STATUS iceAgentReportNewLocalCandidate(PIceAgent pIceAgent, PIceCandidate pIceCa
382384
UINT32 serializedIceCandidateBufLen = ARRAY_SIZE(serializedIceCandidateBuf);
383385

384386
CHK(pIceAgent != NULL && pIceCandidate != NULL, STATUS_NULL_ARG);
385-
386387
iceAgentLogNewCandidate(pIceCandidate);
387388

388389
CHK_WARN(pIceAgent->iceAgentCallbacks.newLocalCandidateFn != NULL, retStatus, "newLocalCandidateFn callback not implemented");
@@ -919,7 +920,7 @@ STATUS iceAgentRestart(PIceAgent pIceAgent, PCHAR localIceUfrag, PCHAR localIceP
919920
CHK(pIceAgent != NULL, STATUS_NULL_ARG);
920921
CHK(!ATOMIC_LOAD_BOOL(&pIceAgent->shutdown), STATUS_INVALID_OPERATION);
921922

922-
DLOGD("Restarting ICE");
923+
DLOGI("Restarting ICE");
923924

924925
alreadyRestarting = ATOMIC_EXCHANGE_BOOL(&pIceAgent->restart, TRUE);
925926
CHK(!alreadyRestarting, retStatus);
@@ -948,6 +949,8 @@ STATUS iceAgentRestart(PIceAgent pIceAgent, PCHAR localIceUfrag, PCHAR localIceP
948949
pIceAgent->iceAgentStatus = STATUS_SUCCESS;
949950
pIceAgent->lastDataReceivedTime = INVALID_TIMESTAMP_VALUE;
950951
pIceAgent->relayCandidateCount = 0;
952+
ATOMIC_STORE_BOOL(&pIceAgent->addedRelayCandidate, FALSE);
953+
ATOMIC_STORE_BOOL(&pIceAgent->stopGathering, FALSE);
951954

952955
CHK_STATUS(doubleListGetHeadNode(pIceAgent->localCandidates, &pCurNode));
953956
while (pCurNode != NULL) {
@@ -1627,7 +1630,6 @@ STATUS iceAgentGatherCandidateTimerCallback(UINT32 timerId, UINT64 currentTime,
16271630

16281631
MUTEX_LOCK(pIceAgent->lock);
16291632
locked = TRUE;
1630-
16311633
CHK_STATUS(doubleListGetHeadNode(pIceAgent->localCandidates, &pCurNode));
16321634
while (pCurNode != NULL) {
16331635
CHK_STATUS(doubleListGetNodeData(pCurNode, &data));
@@ -1663,10 +1665,14 @@ STATUS iceAgentGatherCandidateTimerCallback(UINT32 timerId, UINT64 currentTime,
16631665
if (pendingSrflxCandidateCount > 0) {
16641666
CHK_STATUS(iceAgentSendSrflxCandidateRequest(pIceAgent));
16651667
}
1666-
1667-
/* stop scheduling if there is no more pending candidate or if timeout is reached. */
1668-
if ((totalCandidateCount > 0 && pendingCandidateCount == 0) || currentTime >= pIceAgent->candidateGatheringEndTime) {
1668+
/* stop scheduling if there is a nominated candidate pair (in cases where the pair does not have relay, which is set via stopGathering flag), no
1669+
* more pending candidate and relay candidates are added or if timeout is reached. */
1670+
if (ATOMIC_LOAD_BOOL(&pIceAgent->stopGathering) ||
1671+
(totalCandidateCount > 0 && pendingCandidateCount == 0 && ATOMIC_LOAD_BOOL(&pIceAgent->addedRelayCandidate)) ||
1672+
currentTime >= pIceAgent->candidateGatheringEndTime) {
16691673
DLOGI("Candidate gathering completed.");
1674+
PROFILE_WITH_START_END_TIME_OBJ(pIceAgent->candidateGatheringStartTime, pIceAgent->candidateGatheringProcessEndTime,
1675+
pIceAgent->iceAgentProfileDiagnostics.candidateGatheringTime, "Candidate gathering time");
16701676
stopScheduling = TRUE;
16711677
pIceAgent->iceCandidateGatheringTimerTask = MAX_UINT32;
16721678
}
@@ -1682,8 +1688,6 @@ STATUS iceAgentGatherCandidateTimerCallback(UINT32 timerId, UINT64 currentTime,
16821688

16831689
if (stopScheduling) {
16841690
ATOMIC_STORE_BOOL(&pIceAgent->candidateGatheringFinished, TRUE);
1685-
PROFILE_WITH_START_END_TIME_OBJ(pIceAgent->candidateGatheringStartTime, pIceAgent->candidateGatheringProcessEndTime,
1686-
pIceAgent->iceAgentProfileDiagnostics.candidateGatheringTime, "Candidate gathering time");
16871691
/* notify that candidate gathering is finished. */
16881692
if (pIceAgent->iceAgentCallbacks.newLocalCandidateFn != NULL) {
16891693
pIceAgent->iceAgentCallbacks.newLocalCandidateFn(pIceAgent->iceAgentCallbacks.customData, NULL);
@@ -2242,6 +2246,8 @@ STATUS iceAgentReadyStateSetup(PIceAgent pIceAgent)
22422246
}
22432247
CHK(pNominatedAndValidCandidatePair != NULL, STATUS_ICE_NO_NOMINATED_VALID_CANDIDATE_PAIR_AVAILABLE);
22442248
pIceAgent->pDataSendingIceCandidatePair = pNominatedAndValidCandidatePair;
2249+
// Set to stop gathering
2250+
ATOMIC_STORE_BOOL(&pIceAgent->stopGathering, TRUE);
22452251
}
22462252

22472253
CHK_STATUS(getIpAddrStr(&pIceAgent->pDataSendingIceCandidatePair->local->ipAddress, ipAddrStr, ARRAY_SIZE(ipAddrStr)));
@@ -2252,7 +2258,6 @@ STATUS iceAgentReadyStateSetup(PIceAgent pIceAgent)
22522258
iceAgentGetCandidateTypeStr(pIceAgent->pDataSendingIceCandidatePair->remote->iceCandidateType),
22532259
pIceAgent->pDataSendingIceCandidatePair->roundTripTime / HUNDREDS_OF_NANOS_IN_A_MILLISECOND,
22542260
pIceAgent->pDataSendingIceCandidatePair->local->priority, pIceAgent->pDataSendingIceCandidatePair->priority);
2255-
22562261
/* no state timeout for ready state */
22572262
pIceAgent->stateEndTime = INVALID_TIMESTAMP_VALUE;
22582263

src/source/Ice/IceAgent.h

+2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ struct __IceAgent {
204204
volatile ATOMIC_BOOL shutdown;
205205
volatile ATOMIC_BOOL restart;
206206
volatile ATOMIC_BOOL processStun;
207+
volatile ATOMIC_BOOL addedRelayCandidate;
208+
volatile ATOMIC_BOOL stopGathering;
207209

208210
CHAR localUsername[MAX_ICE_CONFIG_USER_NAME_LEN + 1];
209211
CHAR localPassword[MAX_ICE_CONFIG_CREDENTIAL_LEN + 1];

0 commit comments

Comments
 (0)