Do not use UI thread as signaling thread.

peerconnection_client sample on Windows is using the current UI thread
as signaling thread. Create a dedicated thread for that purpose.

Bug: webrtc:13104
Change-Id: Iccff8165373101996913c4389cf134a60051462c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230729
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35078}
diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc
index 005a9d6..744c6b1 100644
--- a/examples/peerconnection/client/conductor.cc
+++ b/examples/peerconnection/client/conductor.cc
@@ -130,9 +130,13 @@
   RTC_DCHECK(!peer_connection_factory_);
   RTC_DCHECK(!peer_connection_);
 
+  if (!signaling_thread_.get()) {
+    signaling_thread_ = rtc::Thread::CreateWithSocketServer();
+    signaling_thread_->Start();
+  }
   peer_connection_factory_ = webrtc::CreatePeerConnectionFactory(
       nullptr /* network_thread */, nullptr /* worker_thread */,
-      nullptr /* signaling_thread */, nullptr /* default_adm */,
+      signaling_thread_.get(), nullptr /* default_adm */,
       webrtc::CreateBuiltinAudioEncoderFactory(),
       webrtc::CreateBuiltinAudioDecoderFactory(),
       webrtc::CreateBuiltinVideoEncoderFactory(),
diff --git a/examples/peerconnection/client/conductor.h b/examples/peerconnection/client/conductor.h
index 3c06857..332cd43 100644
--- a/examples/peerconnection/client/conductor.h
+++ b/examples/peerconnection/client/conductor.h
@@ -21,6 +21,7 @@
 #include "api/peer_connection_interface.h"
 #include "examples/peerconnection/client/main_wnd.h"
 #include "examples/peerconnection/client/peer_connection_client.h"
+#include "rtc_base/thread.h"
 
 namespace webrtc {
 class VideoCaptureModule;
@@ -122,6 +123,7 @@
 
   int peer_id_;
   bool loopback_;
+  std::unique_ptr<rtc::Thread> signaling_thread_;
   rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
   rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
       peer_connection_factory_;