aboutsummaryrefslogtreecommitdiff
path: root/examples/unityplugin/simple_peer_connection.cc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/unityplugin/simple_peer_connection.cc')
-rw-r--r--examples/unityplugin/simple_peer_connection.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/unityplugin/simple_peer_connection.cc b/examples/unityplugin/simple_peer_connection.cc
index 23e4d7b869..c7e5185bdc 100644
--- a/examples/unityplugin/simple_peer_connection.cc
+++ b/examples/unityplugin/simple_peer_connection.cc
@@ -192,10 +192,14 @@ bool SimplePeerConnection::CreatePeerConnection(const char** turn_urls,
config_.servers.push_back(stun_server);
config_.enable_dtls_srtp = false;
- peer_connection_ = g_peer_connection_factory->CreatePeerConnection(
- config_, nullptr, nullptr, this);
-
- return peer_connection_.get() != nullptr;
+ auto result = g_peer_connection_factory->CreatePeerConnectionOrError(
+ config_, webrtc::PeerConnectionDependencies(this));
+ if (!result.ok()) {
+ peer_connection_ = nullptr;
+ return false;
+ }
+ peer_connection_ = result.MoveValue();
+ return true;
}
void SimplePeerConnection::DeletePeerConnection() {
@@ -493,8 +497,9 @@ bool SimplePeerConnection::CreateDataChannel() {
struct webrtc::DataChannelInit init;
init.ordered = true;
init.reliable = true;
- data_channel_ = peer_connection_->CreateDataChannel("Hello", &init);
- if (data_channel_.get()) {
+ auto result = peer_connection_->CreateDataChannelOrError("Hello", &init);
+ if (result.ok()) {
+ data_channel_ = result.MoveValue();
data_channel_->RegisterObserver(this);
RTC_LOG(LS_INFO) << "Succeeds to create data channel";
return true;