Adds the custom TLS certificate verifier pointer to the reconfigure option as
well. This allows the verifier to be attached at a later point after ice
candidates.

Bug: webrtc:9623
Change-Id: I06f31256c494f6a790c6047e8602b8665dfe2f7e
Reviewed-on: https://webrtc-review.googlesource.com/93943
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24280}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index dd3278d..e068f60 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -4754,16 +4754,15 @@
   port_allocator_->set_max_ipv6_networks(configuration.max_ipv6_networks);
 
   auto turn_servers_copy = turn_servers;
-  if (tls_cert_verifier_ != nullptr) {
-    for (auto& turn_server : turn_servers_copy) {
-      turn_server.tls_cert_verifier = tls_cert_verifier_.get();
-    }
+  for (auto& turn_server : turn_servers_copy) {
+    turn_server.tls_cert_verifier = tls_cert_verifier_.get();
   }
   // Call this last since it may create pooled allocator sessions using the
   // properties set above.
   port_allocator_->SetConfiguration(
-      stun_servers, turn_servers_copy, configuration.ice_candidate_pool_size,
-      configuration.prune_turn_ports, configuration.turn_customizer,
+      stun_servers, std::move(turn_servers_copy),
+      configuration.ice_candidate_pool_size, configuration.prune_turn_ports,
+      configuration.turn_customizer,
       configuration.stun_candidate_keepalive_interval);
   return true;
 }
@@ -4784,11 +4783,16 @@
   if (local_description()) {
     port_allocator_->FreezeCandidatePool();
   }
+  // Add the custom tls turn servers if they exist.
+  auto turn_servers_copy = turn_servers;
+  for (auto& turn_server : turn_servers_copy) {
+    turn_server.tls_cert_verifier = tls_cert_verifier_.get();
+  }
   // Call this last since it may create pooled allocator sessions using the
   // candidate filter set above.
   return port_allocator_->SetConfiguration(
-      stun_servers, turn_servers, candidate_pool_size, prune_turn_ports,
-      turn_customizer, stun_candidate_keepalive_interval);
+      stun_servers, std::move(turn_servers_copy), candidate_pool_size,
+      prune_turn_ports, turn_customizer, stun_candidate_keepalive_interval);
 }
 
 cricket::ChannelManager* PeerConnection::channel_manager() const {