Extract method VirtualSocketServer::AssignBindAddress

Bug: webrtc:13065
Change-Id: Ib8ec14dd193457c010ba6ed943c73cc237bf8bae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229982
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34845}
diff --git a/rtc_base/virtual_socket_server.h b/rtc_base/virtual_socket_server.h
index 009ab42..490511b 100644
--- a/rtc_base/virtual_socket_server.h
+++ b/rtc_base/virtual_socket_server.h
@@ -281,8 +281,9 @@
   // socket server. Intended to be used for test assertions.
   uint32_t sent_packets() const { return sent_packets_; }
 
-  // Binds the given socket to addr, assigning and IP and Port if necessary
-  int Bind(VirtualSocket* socket, SocketAddress* addr);
+  // Assign IP and Port if application's address is unspecified. Also apply
+  // `alternative_address_mapping_`.
+  SocketAddress AssignBindAddress(const SocketAddress& app_addr);
 
   // Binds the given socket to the given (fully-defined) address.
   int Bind(VirtualSocket* socket, const SocketAddress& addr);