diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp index 409b858f0325ad4e6254f481a3c87d507680b669..613e8ecf75ff17a00702c1b380c17a14b15c2672 100644 --- a/src/ice_transport.cpp +++ b/src/ice_transport.cpp @@ -1100,7 +1100,8 @@ IceTransport::startIce(const Attribute& rem_attrs, std::vector<IceCandidate>&& r return false; } - if (rem_candidates.size() > PJ_ICE_ST_MAX_CAND - 1) { + auto comp_cnt = std::max(1u, getComponentCount()); + if (rem_candidates.size() / comp_cnt > PJ_ICE_ST_MAX_CAND - 1) { std::vector<IceCandidate> rcands; rcands.reserve(PJ_ICE_ST_MAX_CAND - 1); JAMI_WARN("[ice:%p] too much candidates detected, trim list.", pimpl_.get());