Created
November 3, 2022 06:41
-
-
Save thebongy/b59446faa4bd72fdfd52dc3a1b24a90a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc | |
index 965525abff..75027ca17e 100644 | |
--- a/examples/peerconnection/client/conductor.cc | |
+++ b/examples/peerconnection/client/conductor.cc | |
@@ -297,6 +297,14 @@ void Conductor::OnPeerDisconnected(int id) { | |
} | |
void Conductor::OnMessageFromPeer(int peer_id, const std::string& message) { | |
+ if (!signaling_thread_.get()) { | |
+ signaling_thread_ = rtc::Thread::CreateWithSocketServer(); | |
+ signaling_thread_->Start(); | |
+ } | |
+ signaling_thread_->PostTask([=] { OnMessageFromPeerOnSignallingThread(peer_id, message); }); | |
+} | |
+ | |
+void Conductor::OnMessageFromPeerOnSignallingThread(int peer_id, const std::string& message) { | |
RTC_DCHECK(peer_id_ == peer_id || peer_id_ == -1); | |
RTC_DCHECK(!message.empty()); | |
diff --git a/examples/peerconnection/client/conductor.h b/examples/peerconnection/client/conductor.h | |
index 80617d3cf4..fac85b3be2 100644 | |
--- a/examples/peerconnection/client/conductor.h | |
+++ b/examples/peerconnection/client/conductor.h | |
@@ -94,6 +94,7 @@ class Conductor : public webrtc::PeerConnectionObserver, | |
void OnPeerDisconnected(int id) override; | |
void OnMessageFromPeer(int peer_id, const std::string& message) override; | |
+ void OnMessageFromPeerOnSignallingThread(int peer_id, const std::string& message); | |
void OnMessageSent(int err) override; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment