Skip to content

Commit

Permalink
Support empty candidate for 'addCandidate' api.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchao-xu committed Oct 31, 2023
1 parent b7c3071 commit a5e5869
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/flutter_webrtc/tizen/src/flutter_webrtc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,16 @@ void FlutterWebRTC::HandleMethodCall(
}

SdpParseError error;
std::string candidate = findString(constraints, "candidate");
if (candidate.empty()) {
LOG_DEBUG("addCandidate, add end-of-candidates");
result->Success();
return;
}

int sdpMLineIndex = findInt(constraints, "sdpMLineIndex");
scoped_refptr<RTCIceCandidate> rtc_candidate = RTCIceCandidate::Create(
findString(constraints, "candidate").c_str(),
findString(constraints, "sdpMid").c_str(),
candidate.c_str(), findString(constraints, "sdpMid").c_str(),
sdpMLineIndex == -1 ? 0 : sdpMLineIndex, &error);

AddIceCandidate(rtc_candidate.get(), pc, std::move(result));
Expand Down

0 comments on commit a5e5869

Please sign in to comment.