2017-09-26 16:20:19 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/peer_connection_wrapper.h"
|
2017-09-26 16:20:19 -07:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stdint.h>
|
2017-09-26 16:20:19 -07:00
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <utility>
|
2017-10-30 09:57:42 -07:00
|
|
|
#include <vector>
|
2017-09-26 16:20:19 -07:00
|
|
|
|
2019-03-21 14:37:36 +01:00
|
|
|
#include "api/function_view.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/set_remote_description_observer_interface.h"
|
|
|
|
|
#include "pc/sdp_utils.h"
|
|
|
|
|
#include "pc/test/fake_video_track_source.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "rtc_base/checks.h"
|
2017-09-26 16:20:19 -07:00
|
|
|
#include "rtc_base/gunit.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "rtc_base/logging.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/ref_counted_object.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "test/gtest.h"
|
2017-09-26 16:20:19 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-01-25 13:58:07 -08:00
|
|
|
using RTCOfferAnswerOptions = PeerConnectionInterface::RTCOfferAnswerOptions;
|
|
|
|
|
|
2017-09-26 16:20:19 -07:00
|
|
|
namespace {
|
2017-10-23 09:39:20 -07:00
|
|
|
const uint32_t kDefaultTimeout = 10000U;
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionWrapper::PeerConnectionWrapper(
|
|
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory,
|
|
|
|
|
rtc::scoped_refptr<PeerConnectionInterface> pc,
|
|
|
|
|
std::unique_ptr<MockPeerConnectionObserver> observer)
|
2017-11-13 11:50:33 +01:00
|
|
|
: pc_factory_(std::move(pc_factory)),
|
|
|
|
|
observer_(std::move(observer)),
|
|
|
|
|
pc_(std::move(pc)) {
|
2017-09-26 16:20:19 -07:00
|
|
|
RTC_DCHECK(pc_factory_);
|
|
|
|
|
RTC_DCHECK(pc_);
|
|
|
|
|
RTC_DCHECK(observer_);
|
|
|
|
|
observer_->SetPeerConnectionInterface(pc_.get());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionWrapper::~PeerConnectionWrapper() = default;
|
|
|
|
|
|
|
|
|
|
PeerConnectionFactoryInterface* PeerConnectionWrapper::pc_factory() {
|
|
|
|
|
return pc_factory_.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionInterface* PeerConnectionWrapper::pc() {
|
|
|
|
|
return pc_.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MockPeerConnectionObserver* PeerConnectionWrapper::observer() {
|
|
|
|
|
return observer_.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateOffer() {
|
2018-01-25 13:58:07 -08:00
|
|
|
return CreateOffer(RTCOfferAnswerOptions());
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface> PeerConnectionWrapper::CreateOffer(
|
2017-10-20 15:30:51 -07:00
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options,
|
|
|
|
|
std::string* error_out) {
|
|
|
|
|
return CreateSdp(
|
|
|
|
|
[this, options](CreateSessionDescriptionObserver* observer) {
|
|
|
|
|
pc()->CreateOffer(observer, options);
|
|
|
|
|
},
|
|
|
|
|
error_out);
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateOfferAndSetAsLocal() {
|
2018-01-25 13:58:07 -08:00
|
|
|
return CreateOfferAndSetAsLocal(RTCOfferAnswerOptions());
|
2017-10-20 15:30:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateOfferAndSetAsLocal(
|
|
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
|
|
|
|
auto offer = CreateOffer(options);
|
2017-09-26 16:20:19 -07:00
|
|
|
if (!offer) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
EXPECT_TRUE(SetLocalDescription(CloneSessionDescription(offer.get())));
|
|
|
|
|
return offer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateAnswer() {
|
2018-01-25 13:58:07 -08:00
|
|
|
return CreateAnswer(RTCOfferAnswerOptions());
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateAnswer(
|
2017-10-20 15:30:51 -07:00
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options,
|
|
|
|
|
std::string* error_out) {
|
|
|
|
|
return CreateSdp(
|
|
|
|
|
[this, options](CreateSessionDescriptionObserver* observer) {
|
|
|
|
|
pc()->CreateAnswer(observer, options);
|
|
|
|
|
},
|
|
|
|
|
error_out);
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateAnswerAndSetAsLocal() {
|
2018-01-25 13:58:07 -08:00
|
|
|
return CreateAnswerAndSetAsLocal(RTCOfferAnswerOptions());
|
2017-10-20 15:30:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateAnswerAndSetAsLocal(
|
|
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
|
|
|
|
auto answer = CreateAnswer(options);
|
2017-09-26 16:20:19 -07:00
|
|
|
if (!answer) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
EXPECT_TRUE(SetLocalDescription(CloneSessionDescription(answer.get())));
|
|
|
|
|
return answer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface> PeerConnectionWrapper::CreateSdp(
|
2017-11-13 11:50:33 +01:00
|
|
|
rtc::FunctionView<void(CreateSessionDescriptionObserver*)> fn,
|
2017-10-20 15:30:51 -07:00
|
|
|
std::string* error_out) {
|
2017-09-26 16:20:19 -07:00
|
|
|
rtc::scoped_refptr<MockCreateSessionDescriptionObserver> observer(
|
|
|
|
|
new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>());
|
|
|
|
|
fn(observer);
|
2017-10-23 09:39:20 -07:00
|
|
|
EXPECT_EQ_WAIT(true, observer->called(), kDefaultTimeout);
|
2017-10-20 15:30:51 -07:00
|
|
|
if (error_out && !observer->result()) {
|
|
|
|
|
*error_out = observer->error();
|
|
|
|
|
}
|
2017-09-26 16:20:19 -07:00
|
|
|
return observer->MoveDescription();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PeerConnectionWrapper::SetLocalDescription(
|
2017-10-20 15:30:51 -07:00
|
|
|
std::unique_ptr<SessionDescriptionInterface> desc,
|
|
|
|
|
std::string* error_out) {
|
|
|
|
|
return SetSdp(
|
|
|
|
|
[this, &desc](SetSessionDescriptionObserver* observer) {
|
|
|
|
|
pc()->SetLocalDescription(observer, desc.release());
|
|
|
|
|
},
|
|
|
|
|
error_out);
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PeerConnectionWrapper::SetRemoteDescription(
|
2017-10-20 15:30:51 -07:00
|
|
|
std::unique_ptr<SessionDescriptionInterface> desc,
|
|
|
|
|
std::string* error_out) {
|
|
|
|
|
return SetSdp(
|
|
|
|
|
[this, &desc](SetSessionDescriptionObserver* observer) {
|
|
|
|
|
pc()->SetRemoteDescription(observer, desc.release());
|
|
|
|
|
},
|
|
|
|
|
error_out);
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
Reland "SetRemoteDescriptionObserverInterface added."
Description for changes from the original CL:
Calling legacy SRD, implemented using
SetRemoteDescriptionObserverAdapter wrapping the old observer, was
meant to have the exact same behavior as the legacy SRD implementation
which invokes the callbacks in a Post.
However, in the CL that landed and got reverted (PS1), the Adapter had
its own message handler, and callbacks would be invoked even if the PC
was destroyed.
In PS2 I've changed the Adapter to use the PeerConnection's message
handler. If the PC is destroyed, the callback will not be invoked.
This gives identical behavior to before this CL, and the legacy
behavior is covered by a new unittest.
I changed the adapter to be an implementation detail of
peerconnection.cc, therefor some stuff was moved, and the only tests
covering this is now in peerconnection_rtp_unittest.cc.
This is a reland of 6c7ec32bd63ab2b45d4d83ae1de817ee946b4d72
Original change's description:
> SetRemoteDescriptionObserverInterface added.
>
> The new observer replaced SetSessionDescriptionObserver for
> SetRemoteDescription. Unlike SetSessionDescriptionObserver,
> SetRemoteDescriptionObserverInterface is invoked synchronously so
> that the you can rely on the state of the PeerConnection to represent
> the result of the SetRemoteDescription call in the callback.
>
> The new observer succeeds or fails with an RTCError.
>
> This deprecates the need for PeerConnectionObserver::OnAdd/RemoveTrack
> and SetSessionDescriptionObserver, with the benefit that all media
> object changes can be processed in a single callback by the application
> in a synchronous callback. This will help Chromium keep objects in-sync
> across layers and threads in a non-racy and straight-forward way, see
> design doc (Proposal 2):
> https://docs.google.com/a/google.com/document/d/1-cDDC82mgU5zrHacfFz720p3xwRtuBkOPSRchh07Ho0/edit?usp=sharing
>
> An adapter for SetSessionDescriptionObserver is added to allow calling
> the old SetRemoteDescription signature and get the old behavior
> (OnSuccess/OnFailure callback in a Post) until third parties switch.
>
> Bug: webrtc:8473
> Change-Id: I3d4eb60da6dd34615f2c9f384aeaf4634e648c99
> Reviewed-on: https://webrtc-review.googlesource.com/17523
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
> Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20841}
TBR=pthatcher@webrtc.org
Bug: webrtc:8473
Change-Id: If2b1a1929663b0e77fcc9c2ebeef043e6f73adf5
Reviewed-on: https://webrtc-review.googlesource.com/25640
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20854}
2017-11-23 17:48:32 +01:00
|
|
|
bool PeerConnectionWrapper::SetRemoteDescription(
|
|
|
|
|
std::unique_ptr<SessionDescriptionInterface> desc,
|
|
|
|
|
RTCError* error_out) {
|
|
|
|
|
rtc::scoped_refptr<MockSetRemoteDescriptionObserver> observer =
|
|
|
|
|
new MockSetRemoteDescriptionObserver();
|
|
|
|
|
pc()->SetRemoteDescription(std::move(desc), observer);
|
|
|
|
|
EXPECT_EQ_WAIT(true, observer->called(), kDefaultTimeout);
|
|
|
|
|
bool ok = observer->error().ok();
|
|
|
|
|
if (error_out)
|
|
|
|
|
*error_out = std::move(observer->error());
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-26 16:20:19 -07:00
|
|
|
bool PeerConnectionWrapper::SetSdp(
|
2017-11-13 11:50:33 +01:00
|
|
|
rtc::FunctionView<void(SetSessionDescriptionObserver*)> fn,
|
2017-10-20 15:30:51 -07:00
|
|
|
std::string* error_out) {
|
2017-09-26 16:20:19 -07:00
|
|
|
rtc::scoped_refptr<MockSetSessionDescriptionObserver> observer(
|
|
|
|
|
new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
|
|
|
|
|
fn(observer);
|
2017-10-23 09:39:20 -07:00
|
|
|
EXPECT_EQ_WAIT(true, observer->called(), kDefaultTimeout);
|
2017-10-20 15:30:51 -07:00
|
|
|
if (error_out && !observer->result()) {
|
|
|
|
|
*error_out = observer->error();
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
return observer->result();
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-22 16:02:54 -08:00
|
|
|
bool PeerConnectionWrapper::ExchangeOfferAnswerWith(
|
|
|
|
|
PeerConnectionWrapper* answerer) {
|
2018-01-25 13:58:07 -08:00
|
|
|
return ExchangeOfferAnswerWith(answerer, RTCOfferAnswerOptions(),
|
|
|
|
|
RTCOfferAnswerOptions());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PeerConnectionWrapper::ExchangeOfferAnswerWith(
|
|
|
|
|
PeerConnectionWrapper* answerer,
|
|
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& offer_options,
|
|
|
|
|
const PeerConnectionInterface::RTCOfferAnswerOptions& answer_options) {
|
2017-12-22 16:02:54 -08:00
|
|
|
RTC_DCHECK(answerer);
|
|
|
|
|
if (answerer == this) {
|
|
|
|
|
RTC_LOG(LS_ERROR) << "Cannot exchange offer/answer with ourself!";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-01-25 13:58:07 -08:00
|
|
|
auto offer = CreateOffer(offer_options);
|
2017-12-22 16:02:54 -08:00
|
|
|
EXPECT_TRUE(offer);
|
|
|
|
|
if (!offer) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool set_local_offer =
|
|
|
|
|
SetLocalDescription(CloneSessionDescription(offer.get()));
|
|
|
|
|
EXPECT_TRUE(set_local_offer);
|
|
|
|
|
if (!set_local_offer) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool set_remote_offer = answerer->SetRemoteDescription(std::move(offer));
|
|
|
|
|
EXPECT_TRUE(set_remote_offer);
|
|
|
|
|
if (!set_remote_offer) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-01-25 13:58:07 -08:00
|
|
|
auto answer = answerer->CreateAnswer(answer_options);
|
2017-12-22 16:02:54 -08:00
|
|
|
EXPECT_TRUE(answer);
|
|
|
|
|
if (!answer) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool set_local_answer =
|
|
|
|
|
answerer->SetLocalDescription(CloneSessionDescription(answer.get()));
|
|
|
|
|
EXPECT_TRUE(set_local_answer);
|
|
|
|
|
if (!set_local_answer) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool set_remote_answer = SetRemoteDescription(std::move(answer));
|
|
|
|
|
EXPECT_TRUE(set_remote_answer);
|
|
|
|
|
return set_remote_answer;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-27 13:01:52 -08:00
|
|
|
rtc::scoped_refptr<RtpTransceiverInterface>
|
|
|
|
|
PeerConnectionWrapper::AddTransceiver(cricket::MediaType media_type) {
|
|
|
|
|
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> result =
|
|
|
|
|
pc()->AddTransceiver(media_type);
|
|
|
|
|
EXPECT_EQ(RTCErrorType::NONE, result.error().type());
|
|
|
|
|
return result.MoveValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<RtpTransceiverInterface>
|
|
|
|
|
PeerConnectionWrapper::AddTransceiver(cricket::MediaType media_type,
|
|
|
|
|
const RtpTransceiverInit& init) {
|
|
|
|
|
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> result =
|
|
|
|
|
pc()->AddTransceiver(media_type, init);
|
|
|
|
|
EXPECT_EQ(RTCErrorType::NONE, result.error().type());
|
|
|
|
|
return result.MoveValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<RtpTransceiverInterface>
|
|
|
|
|
PeerConnectionWrapper::AddTransceiver(
|
|
|
|
|
rtc::scoped_refptr<MediaStreamTrackInterface> track) {
|
|
|
|
|
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> result =
|
|
|
|
|
pc()->AddTransceiver(track);
|
|
|
|
|
EXPECT_EQ(RTCErrorType::NONE, result.error().type());
|
|
|
|
|
return result.MoveValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<RtpTransceiverInterface>
|
|
|
|
|
PeerConnectionWrapper::AddTransceiver(
|
|
|
|
|
rtc::scoped_refptr<MediaStreamTrackInterface> track,
|
|
|
|
|
const RtpTransceiverInit& init) {
|
|
|
|
|
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> result =
|
|
|
|
|
pc()->AddTransceiver(track, init);
|
|
|
|
|
EXPECT_EQ(RTCErrorType::NONE, result.error().type());
|
|
|
|
|
return result.MoveValue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<AudioTrackInterface> PeerConnectionWrapper::CreateAudioTrack(
|
|
|
|
|
const std::string& label) {
|
|
|
|
|
return pc_factory()->CreateAudioTrack(label, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<VideoTrackInterface> PeerConnectionWrapper::CreateVideoTrack(
|
|
|
|
|
const std::string& label) {
|
2018-05-29 09:13:57 +02:00
|
|
|
return pc_factory()->CreateVideoTrack(label, FakeVideoTrackSource::Create());
|
2017-11-27 13:01:52 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-05 17:10:52 -08:00
|
|
|
rtc::scoped_refptr<RtpSenderInterface> PeerConnectionWrapper::AddTrack(
|
|
|
|
|
rtc::scoped_refptr<MediaStreamTrackInterface> track,
|
2018-03-02 11:34:10 -08:00
|
|
|
const std::vector<std::string>& stream_ids) {
|
2018-01-05 17:10:52 -08:00
|
|
|
RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> result =
|
2018-03-02 11:34:10 -08:00
|
|
|
pc()->AddTrack(track, stream_ids);
|
2018-01-05 17:10:52 -08:00
|
|
|
EXPECT_EQ(RTCErrorType::NONE, result.error().type());
|
|
|
|
|
return result.MoveValue();
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-20 15:30:51 -07:00
|
|
|
rtc::scoped_refptr<RtpSenderInterface> PeerConnectionWrapper::AddAudioTrack(
|
|
|
|
|
const std::string& track_label,
|
2018-03-02 11:34:10 -08:00
|
|
|
const std::vector<std::string>& stream_ids) {
|
|
|
|
|
return AddTrack(CreateAudioTrack(track_label), stream_ids);
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
2017-10-20 15:30:51 -07:00
|
|
|
rtc::scoped_refptr<RtpSenderInterface> PeerConnectionWrapper::AddVideoTrack(
|
|
|
|
|
const std::string& track_label,
|
2018-03-02 11:34:10 -08:00
|
|
|
const std::vector<std::string>& stream_ids) {
|
|
|
|
|
return AddTrack(CreateVideoTrack(track_label), stream_ids);
|
2017-10-20 15:30:51 -07:00
|
|
|
}
|
|
|
|
|
|
2017-12-28 16:38:23 -08:00
|
|
|
rtc::scoped_refptr<DataChannelInterface>
|
|
|
|
|
PeerConnectionWrapper::CreateDataChannel(const std::string& label) {
|
|
|
|
|
return pc()->CreateDataChannel(label, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-20 15:30:51 -07:00
|
|
|
PeerConnectionInterface::SignalingState
|
|
|
|
|
PeerConnectionWrapper::signaling_state() {
|
|
|
|
|
return pc()->signaling_state();
|
2017-09-26 16:20:19 -07:00
|
|
|
}
|
|
|
|
|
|
2017-10-13 11:13:35 -07:00
|
|
|
bool PeerConnectionWrapper::IsIceGatheringDone() {
|
2017-10-23 09:39:20 -07:00
|
|
|
return observer()->ice_gathering_complete_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PeerConnectionWrapper::IsIceConnected() {
|
|
|
|
|
return observer()->ice_connected_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<const webrtc::RTCStatsReport>
|
|
|
|
|
PeerConnectionWrapper::GetStats() {
|
|
|
|
|
rtc::scoped_refptr<webrtc::MockRTCStatsCollectorCallback> callback(
|
|
|
|
|
new rtc::RefCountedObject<webrtc::MockRTCStatsCollectorCallback>());
|
|
|
|
|
pc()->GetStats(callback);
|
|
|
|
|
EXPECT_TRUE_WAIT(callback->called(), kDefaultTimeout);
|
|
|
|
|
return callback->report();
|
2017-10-13 11:13:35 -07:00
|
|
|
}
|
|
|
|
|
|
2017-09-26 16:20:19 -07:00
|
|
|
} // namespace webrtc
|