Document that BasicPortAllocator requires a NetworkManager.

And add a corresponding DCHECK.

Bug: webrtc:13145
Change-Id: I748f686763fa5c7f04c64d5b0cecaf8fc122052d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250124
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35883}
This commit is contained in:
Niels Möller
2022-02-01 15:00:50 +01:00
committed by WebRTC LUCI CQ
parent 5423c83731
commit c79dc98a60
2 changed files with 7 additions and 2 deletions

View File

@ -179,6 +179,7 @@ BasicPortAllocator::BasicPortAllocator(rtc::NetworkManager* network_manager,
: network_manager_(network_manager), socket_factory_(socket_factory) {
InitRelayPortFactory(nullptr);
RTC_DCHECK(relay_port_factory_ != nullptr);
RTC_DCHECK(network_manager_ != nullptr);
SetConfiguration(stun_servers, std::vector<RelayServerConfig>(), 0,
webrtc::NO_PRUNE, nullptr);
}

View File

@ -30,8 +30,12 @@ namespace cricket {
class RTC_EXPORT BasicPortAllocator : public PortAllocator {
public:
// note: The (optional) relay_port_factory is owned by caller
// and must have a life time that exceeds that of BasicPortAllocator.
// The NetworkManager is a mandatory argument. The other arguments are
// optional. All these objects are owned by caller and must have a life time
// that exceeds that of BasicPortAllocator.
// TODO(bugs.webrtc.org/13145): The SocketFactory should be mandatory, but
// currenly isn't. When not specified, one is created internally, based on the
// socket server associated with the thread calling CreateSession.
BasicPortAllocator(rtc::NetworkManager* network_manager,
rtc::PacketSocketFactory* socket_factory,
webrtc::TurnCustomizer* customizer = nullptr,