Skip to content

Commit

Permalink
filter out invalid candidate in sdp (awslabs#1260)
Browse files Browse the repository at this point in the history
Co-authored-by: liyufang <[email protected]>
  • Loading branch information
northteam and liyufang committed Sep 4, 2021
1 parent c2e1c8c commit ddff6df
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/source/Ice/IceAgent.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ STATUS iceAgentPopulateSdpMediaDescriptionCandidates(PIceAgent pIceAgent, PSdpMe
PDoubleListNode pCurNode = NULL;
BOOL locked = FALSE;
UINT32 attrIndex;
PIceCandidate pCandidate = NULL;

CHK(pIceAgent != NULL && pSdpMediaDescription != NULL && pIndex != NULL, STATUS_NULL_ARG);

Expand All @@ -705,10 +706,12 @@ STATUS iceAgentPopulateSdpMediaDescriptionCandidates(PIceAgent pIceAgent, PSdpMe
while (pCurNode != NULL) {
CHK_STATUS(doubleListGetNodeData(pCurNode, &data));
pCurNode = pCurNode->pNext;

STRCPY(pSdpMediaDescription->sdpAttributes[attrIndex].attributeName, "candidate");
CHK_STATUS(iceCandidateSerialize((PIceCandidate) data, pSdpMediaDescription->sdpAttributes[attrIndex].attributeValue, &attrBufferLen));
attrIndex++;
pCandidate = (PIceCandidate) data;
if (pCandidate->state == ICE_CANDIDATE_STATE_VALID) {
STRCPY(pSdpMediaDescription->sdpAttributes[attrIndex].attributeName, "candidate");
CHK_STATUS(iceCandidateSerialize((PIceCandidate) data, pSdpMediaDescription->sdpAttributes[attrIndex].attributeValue, &attrBufferLen));
attrIndex++;
}
}

*pIndex = attrIndex;
Expand Down

0 comments on commit ddff6df

Please sign in to comment.