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}
This commit is contained in:
Qiu Jianlin 2021-09-14 12:15:04 +08:00 committed by WebRTC LUCI CQ
parent 7e01b85526
commit a3d8c61313
2 changed files with 7 additions and 1 deletions

View file

@ -130,9 +130,13 @@ bool Conductor::InitializePeerConnection() {
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(),

View file

@ -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 @@ class Conductor : public webrtc::PeerConnectionObserver,
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_;