Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Fix traversal crash of queuedRemoteCandidates #280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/sdk/base/src/main/java/owt/base/PeerConnectionChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,20 @@ private void addOrQueueCandidate(final IceCandidate iceCandidate) {
protected void drainRemoteCandidates() {
DCHECK(pcExecutor);
DCHECK(queuedRemoteCandidates);
synchronized (remoteIceLock) {
for (final IceCandidate candidate : queuedRemoteCandidates) {
pcExecutor.execute(() -> {
pcExecutor.execute(() -> {
synchronized (remoteIceLock) {
Iterator<IceCandidate> iterator = queuedRemoteCandidates.iterator();
while (iterator.hasNext()) {
if (disposed()) {
return;
}
IceCandidate candidate = iterator.next();
Log.d(LOG_TAG, "add ice candidate");
peerConnection.addIceCandidate(candidate);
queuedRemoteCandidates.remove(candidate);
});
iterator.remove();
}
}
}
});
}

private void setRemoteDescription(final SessionDescription remoteDescription) {
Expand Down