Delete almost all use of MediaConstraintsInterface in the PeerConnection API
Bug: webrtc:9239 Change-Id: I04f4370f624346bf72c7e4e090b57987b558213b Reviewed-on: https://webrtc-review.googlesource.com/74420 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24396}
This commit is contained in:
parent
46399993f2
commit
f06f923ef0
@ -469,7 +469,6 @@ if (rtc_include_tests) {
|
|||||||
deps = [
|
deps = [
|
||||||
":array_view",
|
":array_view",
|
||||||
":libjingle_peerconnection_api",
|
":libjingle_peerconnection_api",
|
||||||
":libjingle_peerconnection_test_api",
|
|
||||||
":ortc_api",
|
":ortc_api",
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
|
|||||||
@ -260,4 +260,48 @@ void CopyConstraintsIntoAudioOptions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CopyConstraintsIntoOfferAnswerOptions(
|
||||||
|
const MediaConstraintsInterface* constraints,
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options) {
|
||||||
|
if (!constraints) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool value = false;
|
||||||
|
size_t mandatory_constraints_satisfied = 0;
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kOfferToReceiveAudio, &value,
|
||||||
|
&mandatory_constraints_satisfied)) {
|
||||||
|
offer_answer_options->offer_to_receive_audio =
|
||||||
|
value ? PeerConnectionInterface::RTCOfferAnswerOptions::
|
||||||
|
kOfferToReceiveMediaTrue
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kOfferToReceiveVideo, &value,
|
||||||
|
&mandatory_constraints_satisfied)) {
|
||||||
|
offer_answer_options->offer_to_receive_video =
|
||||||
|
value ? PeerConnectionInterface::RTCOfferAnswerOptions::
|
||||||
|
kOfferToReceiveMediaTrue
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kVoiceActivityDetection, &value,
|
||||||
|
&mandatory_constraints_satisfied)) {
|
||||||
|
offer_answer_options->voice_activity_detection = value;
|
||||||
|
}
|
||||||
|
if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value,
|
||||||
|
&mandatory_constraints_satisfied)) {
|
||||||
|
offer_answer_options->use_rtp_mux = value;
|
||||||
|
}
|
||||||
|
if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart,
|
||||||
|
&value, &mandatory_constraints_satisfied)) {
|
||||||
|
offer_answer_options->ice_restart = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mandatory_constraints_satisfied == constraints->GetMandatory().size();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -13,9 +13,10 @@
|
|||||||
// http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also
|
// http://www.w3.org/TR/mediacapture-streams/#mediastreamconstraints and also
|
||||||
// used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints.
|
// used in WebRTC: http://dev.w3.org/2011/webrtc/editor/webrtc.html#constraints.
|
||||||
|
|
||||||
// This interface is being deprecated in Chrome, and may be removed
|
// Implementation of the w3c constraints spec is the responsibility of the
|
||||||
// from WebRTC too.
|
// browser. Chrome no longer uses the constraints api declared here, and it will
|
||||||
// https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
|
// be removed from WebRTC.
|
||||||
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=9239
|
||||||
|
|
||||||
#ifndef API_MEDIACONSTRAINTSINTERFACE_H_
|
#ifndef API_MEDIACONSTRAINTSINTERFACE_H_
|
||||||
#define API_MEDIACONSTRAINTSINTERFACE_H_
|
#define API_MEDIACONSTRAINTSINTERFACE_H_
|
||||||
@ -144,6 +145,10 @@ void CopyConstraintsIntoAudioOptions(
|
|||||||
const MediaConstraintsInterface* constraints,
|
const MediaConstraintsInterface* constraints,
|
||||||
cricket::AudioOptions* options);
|
cricket::AudioOptions* options);
|
||||||
|
|
||||||
|
bool CopyConstraintsIntoOfferAnswerOptions(
|
||||||
|
const MediaConstraintsInterface* constraints,
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options);
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // API_MEDIACONSTRAINTSINTERFACE_H_
|
#endif // API_MEDIACONSTRAINTSINTERFACE_H_
|
||||||
|
|||||||
@ -31,13 +31,6 @@ PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
|||||||
// removed.
|
// removed.
|
||||||
using PeerConnectionFactoryInterface::CreateVideoSource;
|
using PeerConnectionFactoryInterface::CreateVideoSource;
|
||||||
PROXY_METHOD1(void, SetOptions, const Options&)
|
PROXY_METHOD1(void, SetOptions, const Options&)
|
||||||
PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>,
|
|
||||||
CreatePeerConnection,
|
|
||||||
const PeerConnectionInterface::RTCConfiguration&,
|
|
||||||
const MediaConstraintsInterface*,
|
|
||||||
std::unique_ptr<cricket::PortAllocator>,
|
|
||||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface>,
|
|
||||||
PeerConnectionObserver*);
|
|
||||||
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>,
|
||||||
CreatePeerConnection,
|
CreatePeerConnection,
|
||||||
const PeerConnectionInterface::RTCConfiguration&,
|
const PeerConnectionInterface::RTCConfiguration&,
|
||||||
|
|||||||
@ -247,12 +247,4 @@ PeerConnectionFactoryInterface::CreateVideoSource(
|
|||||||
return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer));
|
return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer));
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<VideoTrackSourceInterface>
|
|
||||||
PeerConnectionFactoryInterface::CreateVideoSource(
|
|
||||||
cricket::VideoCapturer* capturer,
|
|
||||||
const MediaConstraintsInterface* constraints) {
|
|
||||||
return CreateVideoSource(std::unique_ptr<cricket::VideoCapturer>(capturer),
|
|
||||||
constraints);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -846,22 +846,12 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
|||||||
// Create a new offer.
|
// Create a new offer.
|
||||||
// The CreateSessionDescriptionObserver callback will be called when done.
|
// The CreateSessionDescriptionObserver callback will be called when done.
|
||||||
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints) {}
|
const RTCOfferAnswerOptions& options) = 0;
|
||||||
|
|
||||||
// TODO(jiayl): remove the default impl and the old interface when chromium
|
|
||||||
// code is updated.
|
|
||||||
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const RTCOfferAnswerOptions& options) {}
|
|
||||||
|
|
||||||
// Create an answer to an offer.
|
// Create an answer to an offer.
|
||||||
// The CreateSessionDescriptionObserver callback will be called when done.
|
// The CreateSessionDescriptionObserver callback will be called when done.
|
||||||
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) {}
|
const RTCOfferAnswerOptions& options) = 0;
|
||||||
// Deprecated - use version above.
|
|
||||||
// TODO(hta): Remove and remove default implementations when all callers
|
|
||||||
// are updated.
|
|
||||||
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) {}
|
|
||||||
|
|
||||||
// Sets the local session description.
|
// Sets the local session description.
|
||||||
// The PeerConnection takes the ownership of |desc| even if it fails.
|
// The PeerConnection takes the ownership of |desc| even if it fails.
|
||||||
@ -1293,10 +1283,6 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
|
|||||||
// TODO(deadbeef): Remove these once safe to do so.
|
// TODO(deadbeef): Remove these once safe to do so.
|
||||||
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
||||||
cricket::VideoCapturer* capturer);
|
cricket::VideoCapturer* capturer);
|
||||||
virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource(
|
|
||||||
cricket::VideoCapturer* capturer,
|
|
||||||
const MediaConstraintsInterface* constraints);
|
|
||||||
|
|
||||||
// Creates a new local VideoTrack. The same |source| can be used in several
|
// Creates a new local VideoTrack. The same |source| can be used in several
|
||||||
// tracks.
|
// tracks.
|
||||||
virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
|
virtual rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack(
|
||||||
|
|||||||
@ -85,14 +85,6 @@ PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
|||||||
current_local_description)
|
current_local_description)
|
||||||
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
|
||||||
current_remote_description)
|
current_remote_description)
|
||||||
PROXY_METHOD2(void,
|
|
||||||
CreateOffer,
|
|
||||||
CreateSessionDescriptionObserver*,
|
|
||||||
const MediaConstraintsInterface*)
|
|
||||||
PROXY_METHOD2(void,
|
|
||||||
CreateAnswer,
|
|
||||||
CreateSessionDescriptionObserver*,
|
|
||||||
const MediaConstraintsInterface*)
|
|
||||||
PROXY_METHOD2(void,
|
PROXY_METHOD2(void,
|
||||||
CreateOffer,
|
CreateOffer,
|
||||||
CreateSessionDescriptionObserver*,
|
CreateSessionDescriptionObserver*,
|
||||||
|
|||||||
@ -721,7 +721,6 @@ if (is_linux || is_win) {
|
|||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
"../api:libjingle_peerconnection_api",
|
"../api:libjingle_peerconnection_api",
|
||||||
"../api:libjingle_peerconnection_test_api",
|
|
||||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
@ -853,7 +852,6 @@ if (is_win || is_android) {
|
|||||||
}
|
}
|
||||||
deps = [
|
deps = [
|
||||||
"../api:libjingle_peerconnection_api",
|
"../api:libjingle_peerconnection_api",
|
||||||
"../api:libjingle_peerconnection_test_api",
|
|
||||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||||
"../api/video:video_frame",
|
"../api/video:video_frame",
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
||||||
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
||||||
#include "examples/peerconnection/client/defaults.h"
|
#include "examples/peerconnection/client/defaults.h"
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "api/videosourceproxy.h"
|
#include "api/videosourceproxy.h"
|
||||||
#include "media/engine/internaldecoderfactory.h"
|
#include "media/engine/internaldecoderfactory.h"
|
||||||
#include "media/engine/internalencoderfactory.h"
|
#include "media/engine/internalencoderfactory.h"
|
||||||
@ -164,12 +163,11 @@ bool SimplePeerConnection::CreatePeerConnection(const char** turn_urls,
|
|||||||
webrtc::PeerConnectionInterface::IceServer stun_server;
|
webrtc::PeerConnectionInterface::IceServer stun_server;
|
||||||
stun_server.uri = GetPeerConnectionString();
|
stun_server.uri = GetPeerConnectionString();
|
||||||
config_.servers.push_back(stun_server);
|
config_.servers.push_back(stun_server);
|
||||||
|
config_.enable_rtp_data_channel = true;
|
||||||
webrtc::FakeConstraints constraints;
|
config_.enable_dtls_srtp = false;
|
||||||
constraints.SetAllowDtlsSctpDataChannels();
|
|
||||||
|
|
||||||
peer_connection_ = g_peer_connection_factory->CreatePeerConnection(
|
peer_connection_ = g_peer_connection_factory->CreatePeerConnection(
|
||||||
config_, &constraints, nullptr, nullptr, this);
|
config_, nullptr, nullptr, this);
|
||||||
|
|
||||||
return peer_connection_.get() != nullptr;
|
return peer_connection_.get() != nullptr;
|
||||||
}
|
}
|
||||||
@ -207,12 +205,12 @@ bool SimplePeerConnection::CreateOffer() {
|
|||||||
if (!peer_connection_.get())
|
if (!peer_connection_.get())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
webrtc::FakeConstraints constraints;
|
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
if (mandatory_receive_) {
|
if (mandatory_receive_) {
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio = true;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
options.offer_to_receive_video = true;
|
||||||
}
|
}
|
||||||
peer_connection_->CreateOffer(this, &constraints);
|
peer_connection_->CreateOffer(this, options);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,12 +218,12 @@ bool SimplePeerConnection::CreateAnswer() {
|
|||||||
if (!peer_connection_.get())
|
if (!peer_connection_.get())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
webrtc::FakeConstraints constraints;
|
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
if (mandatory_receive_) {
|
if (mandatory_receive_) {
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio = true;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
options.offer_to_receive_video = true;
|
||||||
}
|
}
|
||||||
peer_connection_->CreateAnswer(this, &constraints);
|
peer_connection_->CreateAnswer(this, options);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -338,7 +338,6 @@ if (rtc_include_tests) {
|
|||||||
deps = [
|
deps = [
|
||||||
":pc_test_utils",
|
":pc_test_utils",
|
||||||
"../api:libjingle_peerconnection_api",
|
"../api:libjingle_peerconnection_api",
|
||||||
"../api:libjingle_peerconnection_test_api",
|
|
||||||
"../api:rtc_stats_api",
|
"../api:rtc_stats_api",
|
||||||
"../api/audio_codecs:builtin_audio_decoder_factory",
|
"../api/audio_codecs:builtin_audio_decoder_factory",
|
||||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||||
|
|||||||
@ -13,14 +13,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "media/base/fakemediaengine.h"
|
#include "media/base/fakemediaengine.h"
|
||||||
#include "media/base/fakevideorenderer.h"
|
#include "media/base/fakevideorenderer.h"
|
||||||
#include "rtc_base/gunit.h"
|
#include "rtc_base/gunit.h"
|
||||||
|
|
||||||
using webrtc::LocalAudioSource;
|
using webrtc::LocalAudioSource;
|
||||||
using webrtc::MediaConstraintsInterface;
|
|
||||||
using webrtc::MediaSourceInterface;
|
|
||||||
|
|
||||||
TEST(LocalAudioSourceTest, InitWithAudioOptions) {
|
TEST(LocalAudioSourceTest, InitWithAudioOptions) {
|
||||||
cricket::AudioOptions audio_options;
|
cricket::AudioOptions audio_options;
|
||||||
|
|||||||
@ -773,50 +773,6 @@ void ExtractSharedMediaSessionOptions(
|
|||||||
session_options->bundle_enabled = rtc_options.use_rtp_mux;
|
session_options->bundle_enabled = rtc_options.use_rtp_mux;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConvertConstraintsToOfferAnswerOptions(
|
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options) {
|
|
||||||
if (!constraints) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool value = false;
|
|
||||||
size_t mandatory_constraints_satisfied = 0;
|
|
||||||
|
|
||||||
if (FindConstraint(constraints,
|
|
||||||
MediaConstraintsInterface::kOfferToReceiveAudio, &value,
|
|
||||||
&mandatory_constraints_satisfied)) {
|
|
||||||
offer_answer_options->offer_to_receive_audio =
|
|
||||||
value ? PeerConnectionInterface::RTCOfferAnswerOptions::
|
|
||||||
kOfferToReceiveMediaTrue
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FindConstraint(constraints,
|
|
||||||
MediaConstraintsInterface::kOfferToReceiveVideo, &value,
|
|
||||||
&mandatory_constraints_satisfied)) {
|
|
||||||
offer_answer_options->offer_to_receive_video =
|
|
||||||
value ? PeerConnectionInterface::RTCOfferAnswerOptions::
|
|
||||||
kOfferToReceiveMediaTrue
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
if (FindConstraint(constraints,
|
|
||||||
MediaConstraintsInterface::kVoiceActivityDetection, &value,
|
|
||||||
&mandatory_constraints_satisfied)) {
|
|
||||||
offer_answer_options->voice_activity_detection = value;
|
|
||||||
}
|
|
||||||
if (FindConstraint(constraints, MediaConstraintsInterface::kUseRtpMux, &value,
|
|
||||||
&mandatory_constraints_satisfied)) {
|
|
||||||
offer_answer_options->use_rtp_mux = value;
|
|
||||||
}
|
|
||||||
if (FindConstraint(constraints, MediaConstraintsInterface::kIceRestart,
|
|
||||||
&value, &mandatory_constraints_satisfied)) {
|
|
||||||
offer_answer_options->ice_restart = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mandatory_constraints_satisfied == constraints->GetMandatory().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
PeerConnection::PeerConnection(PeerConnectionFactory* factory,
|
PeerConnection::PeerConnection(PeerConnectionFactory* factory,
|
||||||
std::unique_ptr<RtcEventLog> event_log,
|
std::unique_ptr<RtcEventLog> event_log,
|
||||||
std::unique_ptr<Call> call)
|
std::unique_ptr<Call> call)
|
||||||
@ -1732,23 +1688,6 @@ rtc::scoped_refptr<DataChannelInterface> PeerConnection::CreateDataChannel(
|
|||||||
return DataChannelProxy::Create(signaling_thread(), channel.get());
|
return DataChannelProxy::Create(signaling_thread(), channel.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) {
|
|
||||||
TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
|
|
||||||
|
|
||||||
PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options;
|
|
||||||
// Always create an offer even if |ConvertConstraintsToOfferAnswerOptions|
|
|
||||||
// returns false for now. Because |ConvertConstraintsToOfferAnswerOptions|
|
|
||||||
// compares the mandatory fields parsed with the mandatory fields added in the
|
|
||||||
// |constraints| and some downstream applications might create offers with
|
|
||||||
// mandatory fields which would not be parsed in the helper method. For
|
|
||||||
// example, in Chromium/remoting, |kEnableDtlsSrtp| is added to the
|
|
||||||
// |constraints| as a mandatory field but it is not parsed.
|
|
||||||
ConvertConstraintsToOfferAnswerOptions(constraints, &offer_answer_options);
|
|
||||||
|
|
||||||
CreateOffer(observer, offer_answer_options);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
|
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) {
|
const RTCOfferAnswerOptions& options) {
|
||||||
TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
|
TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
|
||||||
@ -1861,29 +1800,6 @@ PeerConnection::GetReceivingTransceiversOfType(cricket::MediaType media_type) {
|
|||||||
return receiving_transceivers;
|
return receiving_transceivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnection::CreateAnswer(
|
|
||||||
CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) {
|
|
||||||
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
|
|
||||||
|
|
||||||
if (!observer) {
|
|
||||||
RTC_LOG(LS_ERROR) << "CreateAnswer - observer is NULL.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options;
|
|
||||||
if (!ConvertConstraintsToOfferAnswerOptions(constraints,
|
|
||||||
&offer_answer_options)) {
|
|
||||||
std::string error = "CreateAnswer called with invalid constraints.";
|
|
||||||
RTC_LOG(LS_ERROR) << error;
|
|
||||||
PostCreateSessionDescriptionFailure(
|
|
||||||
observer, RTCError(RTCErrorType::INVALID_PARAMETER, std::move(error)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateAnswer(observer, offer_answer_options);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) {
|
const RTCOfferAnswerOptions& options) {
|
||||||
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
|
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
|
||||||
|
|||||||
@ -157,14 +157,8 @@ class PeerConnection : public PeerConnectionInternal,
|
|||||||
const override;
|
const override;
|
||||||
|
|
||||||
// JSEP01
|
// JSEP01
|
||||||
// Deprecated, use version without constraints.
|
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) override;
|
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override;
|
const RTCOfferAnswerOptions& options) override;
|
||||||
// Deprecated, use version without constraints.
|
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) override;
|
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override;
|
const RTCOfferAnswerOptions& options) override;
|
||||||
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
||||||
|
|||||||
@ -598,9 +598,11 @@ TEST_P(PeerConnectionCryptoDtlsCertGenTest, TestCertificateGeneration) {
|
|||||||
new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>();
|
new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>();
|
||||||
observers.push_back(observer);
|
observers.push_back(observer);
|
||||||
if (sdp_type_ == SdpType::kOffer) {
|
if (sdp_type_ == SdpType::kOffer) {
|
||||||
pc->pc()->CreateOffer(observer, nullptr);
|
pc->pc()->CreateOffer(observer,
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
} else {
|
} else {
|
||||||
pc->pc()->CreateAnswer(observer, nullptr);
|
pc->pc()->CreateAnswer(observer,
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto& observer : observers) {
|
for (auto& observer : observers) {
|
||||||
|
|||||||
@ -975,9 +975,9 @@ class PeerConnectionIceConfigTest : public testing::Test {
|
|||||||
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
|
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
|
||||||
port_allocator_ = port_allocator.get();
|
port_allocator_ = port_allocator.get();
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
pc_factory_->CreatePeerConnection(
|
pc_factory_->CreatePeerConnection(config, std::move(port_allocator),
|
||||||
config, nullptr /* constraint */, std::move(port_allocator),
|
nullptr /* cert_generator */,
|
||||||
nullptr /* cert_generator */, &observer_));
|
&observer_));
|
||||||
EXPECT_TRUE(pc.get());
|
EXPECT_TRUE(pc.get());
|
||||||
pc_ = std::move(pc.get());
|
pc_ = std::move(pc.get());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@
|
|||||||
#include "api/peerconnectioninterface.h"
|
#include "api/peerconnectioninterface.h"
|
||||||
#include "api/peerconnectionproxy.h"
|
#include "api/peerconnectionproxy.h"
|
||||||
#include "api/rtpreceiverinterface.h"
|
#include "api/rtpreceiverinterface.h"
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
||||||
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
@ -81,7 +80,6 @@ using webrtc::DataChannelInterface;
|
|||||||
using webrtc::DtmfSender;
|
using webrtc::DtmfSender;
|
||||||
using webrtc::DtmfSenderInterface;
|
using webrtc::DtmfSenderInterface;
|
||||||
using webrtc::DtmfSenderObserverInterface;
|
using webrtc::DtmfSenderObserverInterface;
|
||||||
using webrtc::FakeConstraints;
|
|
||||||
using webrtc::FakeVideoTrackRenderer;
|
using webrtc::FakeVideoTrackRenderer;
|
||||||
using webrtc::MediaConstraintsInterface;
|
using webrtc::MediaConstraintsInterface;
|
||||||
using webrtc::MediaStreamInterface;
|
using webrtc::MediaStreamInterface;
|
||||||
@ -236,8 +234,8 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
|||||||
PeerConnectionWrapper* client(new PeerConnectionWrapper(debug_name));
|
PeerConnectionWrapper* client(new PeerConnectionWrapper(debug_name));
|
||||||
webrtc::PeerConnectionDependencies dependencies(nullptr);
|
webrtc::PeerConnectionDependencies dependencies(nullptr);
|
||||||
dependencies.cert_generator = std::move(cert_generator);
|
dependencies.cert_generator = std::move(cert_generator);
|
||||||
if (!client->Init(nullptr, nullptr, nullptr, std::move(dependencies),
|
if (!client->Init(nullptr, nullptr, std::move(dependencies), network_thread,
|
||||||
network_thread, worker_thread, nullptr)) {
|
worker_thread, nullptr)) {
|
||||||
delete client;
|
delete client;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -561,8 +559,7 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
|||||||
explicit PeerConnectionWrapper(const std::string& debug_name)
|
explicit PeerConnectionWrapper(const std::string& debug_name)
|
||||||
: debug_name_(debug_name) {}
|
: debug_name_(debug_name) {}
|
||||||
|
|
||||||
bool Init(const MediaConstraintsInterface* constraints,
|
bool Init(const PeerConnectionFactory::Options* options,
|
||||||
const PeerConnectionFactory::Options* options,
|
|
||||||
const PeerConnectionInterface::RTCConfiguration* config,
|
const PeerConnectionInterface::RTCConfiguration* config,
|
||||||
webrtc::PeerConnectionDependencies dependencies,
|
webrtc::PeerConnectionDependencies dependencies,
|
||||||
rtc::Thread* network_thread,
|
rtc::Thread* network_thread,
|
||||||
@ -619,13 +616,11 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies.allocator = std::move(port_allocator);
|
dependencies.allocator = std::move(port_allocator);
|
||||||
peer_connection_ =
|
peer_connection_ = CreatePeerConnection(config, std::move(dependencies));
|
||||||
CreatePeerConnection(constraints, config, std::move(dependencies));
|
|
||||||
return peer_connection_.get() != nullptr;
|
return peer_connection_.get() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
|
rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
const PeerConnectionInterface::RTCConfiguration* config,
|
const PeerConnectionInterface::RTCConfiguration* config,
|
||||||
webrtc::PeerConnectionDependencies dependencies) {
|
webrtc::PeerConnectionDependencies dependencies) {
|
||||||
PeerConnectionInterface::RTCConfiguration modified_config;
|
PeerConnectionInterface::RTCConfiguration modified_config;
|
||||||
@ -640,12 +635,6 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
|||||||
// ratios and not specific resolutions, is this even necessary?
|
// ratios and not specific resolutions, is this even necessary?
|
||||||
modified_config.set_cpu_adaptation(false);
|
modified_config.set_cpu_adaptation(false);
|
||||||
|
|
||||||
// Use the legacy interface.
|
|
||||||
if (constraints != nullptr) {
|
|
||||||
return peer_connection_factory_->CreatePeerConnection(
|
|
||||||
modified_config, constraints, std::move(dependencies.allocator),
|
|
||||||
std::move(dependencies.cert_generator), this);
|
|
||||||
}
|
|
||||||
dependencies.observer = this;
|
dependencies.observer = this;
|
||||||
return peer_connection_factory_->CreatePeerConnection(
|
return peer_connection_factory_->CreatePeerConnection(
|
||||||
modified_config, std::move(dependencies));
|
modified_config, std::move(dependencies));
|
||||||
@ -1154,7 +1143,6 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
// log factory will be used.
|
// log factory will be used.
|
||||||
std::unique_ptr<PeerConnectionWrapper> CreatePeerConnectionWrapper(
|
std::unique_ptr<PeerConnectionWrapper> CreatePeerConnectionWrapper(
|
||||||
const std::string& debug_name,
|
const std::string& debug_name,
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
const PeerConnectionFactory::Options* options,
|
const PeerConnectionFactory::Options* options,
|
||||||
const RTCConfiguration* config,
|
const RTCConfiguration* config,
|
||||||
webrtc::PeerConnectionDependencies dependencies,
|
webrtc::PeerConnectionDependencies dependencies,
|
||||||
@ -1171,9 +1159,9 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
std::unique_ptr<PeerConnectionWrapper> client(
|
std::unique_ptr<PeerConnectionWrapper> client(
|
||||||
new PeerConnectionWrapper(debug_name));
|
new PeerConnectionWrapper(debug_name));
|
||||||
|
|
||||||
if (!client->Init(constraints, options, &modified_config,
|
if (!client->Init(options, &modified_config, std::move(dependencies),
|
||||||
std::move(dependencies), network_thread_.get(),
|
network_thread_.get(), worker_thread_.get(),
|
||||||
worker_thread_.get(), std::move(event_log_factory))) {
|
std::move(event_log_factory))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return client;
|
return client;
|
||||||
@ -1182,13 +1170,12 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
std::unique_ptr<PeerConnectionWrapper>
|
std::unique_ptr<PeerConnectionWrapper>
|
||||||
CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
||||||
const std::string& debug_name,
|
const std::string& debug_name,
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
const PeerConnectionFactory::Options* options,
|
const PeerConnectionFactory::Options* options,
|
||||||
const RTCConfiguration* config,
|
const RTCConfiguration* config,
|
||||||
webrtc::PeerConnectionDependencies dependencies) {
|
webrtc::PeerConnectionDependencies dependencies) {
|
||||||
std::unique_ptr<webrtc::FakeRtcEventLogFactory> event_log_factory(
|
std::unique_ptr<webrtc::FakeRtcEventLogFactory> event_log_factory(
|
||||||
new webrtc::FakeRtcEventLogFactory(rtc::Thread::Current()));
|
new webrtc::FakeRtcEventLogFactory(rtc::Thread::Current()));
|
||||||
return CreatePeerConnectionWrapper(debug_name, constraints, options, config,
|
return CreatePeerConnectionWrapper(debug_name, options, config,
|
||||||
std::move(dependencies),
|
std::move(dependencies),
|
||||||
std::move(event_log_factory));
|
std::move(event_log_factory));
|
||||||
}
|
}
|
||||||
@ -1210,37 +1197,24 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
SdpSemantics original_semantics = sdp_semantics_;
|
SdpSemantics original_semantics = sdp_semantics_;
|
||||||
sdp_semantics_ = caller_semantics;
|
sdp_semantics_ = caller_semantics;
|
||||||
caller_ = CreatePeerConnectionWrapper(
|
caller_ = CreatePeerConnectionWrapper(
|
||||||
"Caller", nullptr, nullptr, nullptr,
|
"Caller", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
nullptr);
|
||||||
sdp_semantics_ = callee_semantics;
|
sdp_semantics_ = callee_semantics;
|
||||||
callee_ = CreatePeerConnectionWrapper(
|
callee_ = CreatePeerConnectionWrapper(
|
||||||
"Callee", nullptr, nullptr, nullptr,
|
"Callee", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
nullptr);
|
||||||
sdp_semantics_ = original_semantics;
|
sdp_semantics_ = original_semantics;
|
||||||
return caller_ && callee_;
|
return caller_ && callee_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatePeerConnectionWrappersWithConstraints(
|
|
||||||
MediaConstraintsInterface* caller_constraints,
|
|
||||||
MediaConstraintsInterface* callee_constraints) {
|
|
||||||
caller_ = CreatePeerConnectionWrapper(
|
|
||||||
"Caller", caller_constraints, nullptr, nullptr,
|
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
|
||||||
callee_ = CreatePeerConnectionWrapper(
|
|
||||||
"Callee", callee_constraints, nullptr, nullptr,
|
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
|
||||||
|
|
||||||
return caller_ && callee_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreatePeerConnectionWrappersWithConfig(
|
bool CreatePeerConnectionWrappersWithConfig(
|
||||||
const PeerConnectionInterface::RTCConfiguration& caller_config,
|
const PeerConnectionInterface::RTCConfiguration& caller_config,
|
||||||
const PeerConnectionInterface::RTCConfiguration& callee_config) {
|
const PeerConnectionInterface::RTCConfiguration& callee_config) {
|
||||||
caller_ = CreatePeerConnectionWrapper(
|
caller_ = CreatePeerConnectionWrapper(
|
||||||
"Caller", nullptr, nullptr, &caller_config,
|
"Caller", nullptr, &caller_config,
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
||||||
callee_ = CreatePeerConnectionWrapper(
|
callee_ = CreatePeerConnectionWrapper(
|
||||||
"Callee", nullptr, nullptr, &callee_config,
|
"Callee", nullptr, &callee_config,
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
||||||
return caller_ && callee_;
|
return caller_ && callee_;
|
||||||
}
|
}
|
||||||
@ -1251,10 +1225,10 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
const PeerConnectionInterface::RTCConfiguration& callee_config,
|
const PeerConnectionInterface::RTCConfiguration& callee_config,
|
||||||
webrtc::PeerConnectionDependencies callee_dependencies) {
|
webrtc::PeerConnectionDependencies callee_dependencies) {
|
||||||
caller_ =
|
caller_ =
|
||||||
CreatePeerConnectionWrapper("Caller", nullptr, nullptr, &caller_config,
|
CreatePeerConnectionWrapper("Caller", nullptr, &caller_config,
|
||||||
std::move(caller_dependencies), nullptr);
|
std::move(caller_dependencies), nullptr);
|
||||||
callee_ =
|
callee_ =
|
||||||
CreatePeerConnectionWrapper("Callee", nullptr, nullptr, &callee_config,
|
CreatePeerConnectionWrapper("Callee", nullptr, &callee_config,
|
||||||
std::move(callee_dependencies), nullptr);
|
std::move(callee_dependencies), nullptr);
|
||||||
return caller_ && callee_;
|
return caller_ && callee_;
|
||||||
}
|
}
|
||||||
@ -1263,10 +1237,10 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
const PeerConnectionFactory::Options& caller_options,
|
const PeerConnectionFactory::Options& caller_options,
|
||||||
const PeerConnectionFactory::Options& callee_options) {
|
const PeerConnectionFactory::Options& callee_options) {
|
||||||
caller_ = CreatePeerConnectionWrapper(
|
caller_ = CreatePeerConnectionWrapper(
|
||||||
"Caller", nullptr, &caller_options, nullptr,
|
"Caller", &caller_options, nullptr,
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
||||||
callee_ = CreatePeerConnectionWrapper(
|
callee_ = CreatePeerConnectionWrapper(
|
||||||
"Callee", nullptr, &callee_options, nullptr,
|
"Callee", &callee_options, nullptr,
|
||||||
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
webrtc::PeerConnectionDependencies(nullptr), nullptr);
|
||||||
return caller_ && callee_;
|
return caller_ && callee_;
|
||||||
}
|
}
|
||||||
@ -1274,10 +1248,10 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
bool CreatePeerConnectionWrappersWithFakeRtcEventLog() {
|
bool CreatePeerConnectionWrappersWithFakeRtcEventLog() {
|
||||||
PeerConnectionInterface::RTCConfiguration default_config;
|
PeerConnectionInterface::RTCConfiguration default_config;
|
||||||
caller_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
caller_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
||||||
"Caller", nullptr, nullptr, &default_config,
|
"Caller", nullptr, &default_config,
|
||||||
webrtc::PeerConnectionDependencies(nullptr));
|
webrtc::PeerConnectionDependencies(nullptr));
|
||||||
callee_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
callee_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
|
||||||
"Callee", nullptr, nullptr, &default_config,
|
"Callee", nullptr, &default_config,
|
||||||
webrtc::PeerConnectionDependencies(nullptr));
|
webrtc::PeerConnectionDependencies(nullptr));
|
||||||
return caller_ && callee_;
|
return caller_ && callee_;
|
||||||
}
|
}
|
||||||
@ -1290,7 +1264,7 @@ class PeerConnectionIntegrationBaseTest : public testing::Test {
|
|||||||
|
|
||||||
webrtc::PeerConnectionDependencies dependencies(nullptr);
|
webrtc::PeerConnectionDependencies dependencies(nullptr);
|
||||||
dependencies.cert_generator = std::move(cert_generator);
|
dependencies.cert_generator = std::move(cert_generator);
|
||||||
return CreatePeerConnectionWrapper("New Peer", nullptr, nullptr, nullptr,
|
return CreatePeerConnectionWrapper("New Peer", nullptr, nullptr,
|
||||||
std::move(dependencies), nullptr);
|
std::move(dependencies), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2906,10 +2880,10 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithGcmCipher) {
|
|||||||
// This test sets up a call between two parties with audio, video and an RTP
|
// This test sets up a call between two parties with audio, video and an RTP
|
||||||
// data channel.
|
// data channel.
|
||||||
TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) {
|
TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) {
|
||||||
FakeConstraints setup_constraints;
|
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||||
setup_constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
|
rtc_config.enable_dtls_srtp = false;
|
||||||
&setup_constraints));
|
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
|
||||||
ConnectFakeSignaling();
|
ConnectFakeSignaling();
|
||||||
// Expect that data channel created on caller side will show up for callee as
|
// Expect that data channel created on caller side will show up for callee as
|
||||||
// well.
|
// well.
|
||||||
@ -2942,10 +2916,10 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) {
|
|||||||
TEST_P(PeerConnectionIntegrationTest,
|
TEST_P(PeerConnectionIntegrationTest,
|
||||||
RtpDataChannelSignaledClosedInCalleeOffer) {
|
RtpDataChannelSignaledClosedInCalleeOffer) {
|
||||||
// Same procedure as above test.
|
// Same procedure as above test.
|
||||||
FakeConstraints setup_constraints;
|
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||||
setup_constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
|
rtc_config.enable_dtls_srtp = false;
|
||||||
&setup_constraints));
|
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
|
||||||
ConnectFakeSignaling();
|
ConnectFakeSignaling();
|
||||||
caller()->CreateDataChannel();
|
caller()->CreateDataChannel();
|
||||||
caller()->AddAudioVideoTracks();
|
caller()->AddAudioVideoTracks();
|
||||||
@ -2984,10 +2958,10 @@ TEST_P(PeerConnectionIntegrationTest,
|
|||||||
virtual_socket_server()->set_delay_mean(5); // 5 ms per hop.
|
virtual_socket_server()->set_delay_mean(5); // 5 ms per hop.
|
||||||
virtual_socket_server()->UpdateDelayDistribution();
|
virtual_socket_server()->UpdateDelayDistribution();
|
||||||
|
|
||||||
FakeConstraints constraints;
|
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
ASSERT_TRUE(
|
rtc_config.enable_dtls_srtp = false;
|
||||||
CreatePeerConnectionWrappersWithConstraints(&constraints, &constraints));
|
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
|
||||||
ConnectFakeSignaling();
|
ConnectFakeSignaling();
|
||||||
caller()->CreateDataChannel();
|
caller()->CreateDataChannel();
|
||||||
caller()->CreateAndSetAndSignalOffer();
|
caller()->CreateAndSetAndSignalOffer();
|
||||||
@ -3023,16 +2997,15 @@ TEST_P(PeerConnectionIntegrationTest,
|
|||||||
// This test sets up a call between two parties with audio, video and but only
|
// This test sets up a call between two parties with audio, video and but only
|
||||||
// the caller client supports RTP data channels.
|
// the caller client supports RTP data channels.
|
||||||
TEST_P(PeerConnectionIntegrationTest, RtpDataChannelsRejectedByCallee) {
|
TEST_P(PeerConnectionIntegrationTest, RtpDataChannelsRejectedByCallee) {
|
||||||
FakeConstraints setup_constraints_1;
|
PeerConnectionInterface::RTCConfiguration rtc_config_1;
|
||||||
setup_constraints_1.SetAllowRtpDataChannels();
|
rtc_config_1.enable_rtp_data_channel = true;
|
||||||
// Must disable DTLS to make negotiation succeed.
|
// Must disable DTLS to make negotiation succeed.
|
||||||
setup_constraints_1.SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config_1.enable_dtls_srtp = false;
|
||||||
false);
|
PeerConnectionInterface::RTCConfiguration rtc_config_2;
|
||||||
FakeConstraints setup_constraints_2;
|
rtc_config_2.enable_dtls_srtp = false;
|
||||||
setup_constraints_2.SetMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config_2.enable_dtls_srtp = false;
|
||||||
false);
|
ASSERT_TRUE(
|
||||||
ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(
|
CreatePeerConnectionWrappersWithConfig(rtc_config_1, rtc_config_2));
|
||||||
&setup_constraints_1, &setup_constraints_2));
|
|
||||||
ConnectFakeSignaling();
|
ConnectFakeSignaling();
|
||||||
caller()->CreateDataChannel();
|
caller()->CreateDataChannel();
|
||||||
caller()->AddAudioVideoTracks();
|
caller()->AddAudioVideoTracks();
|
||||||
@ -3049,10 +3022,10 @@ TEST_P(PeerConnectionIntegrationTest, RtpDataChannelsRejectedByCallee) {
|
|||||||
// This test sets up a call between two parties with audio, and video. When
|
// This test sets up a call between two parties with audio, and video. When
|
||||||
// audio and video is setup and flowing, an RTP data channel is negotiated.
|
// audio and video is setup and flowing, an RTP data channel is negotiated.
|
||||||
TEST_P(PeerConnectionIntegrationTest, AddRtpDataChannelInSubsequentOffer) {
|
TEST_P(PeerConnectionIntegrationTest, AddRtpDataChannelInSubsequentOffer) {
|
||||||
FakeConstraints setup_constraints;
|
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||||
setup_constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints,
|
rtc_config.enable_dtls_srtp = false;
|
||||||
&setup_constraints));
|
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
|
||||||
ConnectFakeSignaling();
|
ConnectFakeSignaling();
|
||||||
// Do initial offer/answer with audio/video.
|
// Do initial offer/answer with audio/video.
|
||||||
caller()->AddAudioVideoTracks();
|
caller()->AddAudioVideoTracks();
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||||
#include "api/stats/rtcstats_objects.h"
|
#include "api/stats/rtcstats_objects.h"
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
||||||
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
||||||
#include "p2p/base/testturnserver.h"
|
#include "p2p/base/testturnserver.h"
|
||||||
|
|||||||
@ -76,16 +76,13 @@ class PeerConnectionEndToEndBaseTest : public sigslot::has_slots<>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CreatePcs(
|
void CreatePcs(
|
||||||
const MediaConstraintsInterface* pc_constraints,
|
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory1,
|
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory1,
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory1,
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory1,
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory2,
|
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory2,
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory2) {
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory2) {
|
||||||
EXPECT_TRUE(caller_->CreatePc(pc_constraints, config_,
|
EXPECT_TRUE(caller_->CreatePc(config_, audio_encoder_factory1,
|
||||||
audio_encoder_factory1,
|
|
||||||
audio_decoder_factory1));
|
audio_decoder_factory1));
|
||||||
EXPECT_TRUE(callee_->CreatePc(pc_constraints, config_,
|
EXPECT_TRUE(callee_->CreatePc(config_, audio_encoder_factory2,
|
||||||
audio_encoder_factory2,
|
|
||||||
audio_decoder_factory2));
|
audio_decoder_factory2));
|
||||||
PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
|
PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
|
||||||
|
|
||||||
@ -96,10 +93,9 @@ class PeerConnectionEndToEndBaseTest : public sigslot::has_slots<>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CreatePcs(
|
void CreatePcs(
|
||||||
const MediaConstraintsInterface* pc_constraints,
|
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
|
||||||
CreatePcs(pc_constraints, audio_encoder_factory, audio_decoder_factory,
|
CreatePcs(audio_encoder_factory, audio_decoder_factory,
|
||||||
audio_encoder_factory, audio_decoder_factory);
|
audio_encoder_factory, audio_decoder_factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +113,10 @@ class PeerConnectionEndToEndBaseTest : public sigslot::has_slots<>,
|
|||||||
callee_->GetAndAddUserMedia(audio, audio_options, video, video_constraints);
|
callee_->GetAndAddUserMedia(audio, audio_options, video, video_constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Negotiate() { caller_->CreateOffer(NULL); }
|
void Negotiate() {
|
||||||
|
caller_->CreateOffer(
|
||||||
|
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
|
}
|
||||||
|
|
||||||
void WaitForCallEstablished() {
|
void WaitForCallEstablished() {
|
||||||
caller_->WaitForCallEstablished();
|
caller_->WaitForCallEstablished();
|
||||||
@ -373,18 +372,16 @@ struct AudioDecoderUnicornSparklesRainbow {
|
|||||||
TEST_P(PeerConnectionEndToEndTest, Call) {
|
TEST_P(PeerConnectionEndToEndTest, Call) {
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> real_decoder_factory =
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> real_decoder_factory =
|
||||||
webrtc::CreateBuiltinAudioDecoderFactory();
|
webrtc::CreateBuiltinAudioDecoderFactory();
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
CreateForwardingMockDecoderFactory(real_decoder_factory.get()));
|
CreateForwardingMockDecoderFactory(real_decoder_factory.get()));
|
||||||
GetAndAddUserMedia();
|
GetAndAddUserMedia();
|
||||||
Negotiate();
|
Negotiate();
|
||||||
WaitForCallEstablished();
|
WaitForCallEstablished();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(PeerConnectionEndToEndTest, CallWithLegacySdp) {
|
TEST_P(PeerConnectionEndToEndTest, CallWithSdesKeyNegotiation) {
|
||||||
FakeConstraints pc_constraints;
|
config_.enable_dtls_srtp = false;
|
||||||
pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
false);
|
|
||||||
CreatePcs(&pc_constraints, webrtc::CreateBuiltinAudioEncoderFactory(),
|
|
||||||
webrtc::CreateBuiltinAudioDecoderFactory());
|
webrtc::CreateBuiltinAudioDecoderFactory());
|
||||||
GetAndAddUserMedia();
|
GetAndAddUserMedia();
|
||||||
Negotiate();
|
Negotiate();
|
||||||
@ -446,8 +443,7 @@ TEST_P(PeerConnectionEndToEndTest, CallWithCustomCodec) {
|
|||||||
|
|
||||||
std::vector<webrtc::AudioCodecPairId> encoder_id1, encoder_id2, decoder_id1,
|
std::vector<webrtc::AudioCodecPairId> encoder_id1, encoder_id2, decoder_id1,
|
||||||
decoder_id2;
|
decoder_id2;
|
||||||
CreatePcs(nullptr,
|
CreatePcs(rtc::scoped_refptr<webrtc::AudioEncoderFactory>(
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory>(
|
|
||||||
new rtc::RefCountedObject<IdLoggingAudioEncoderFactory>(
|
new rtc::RefCountedObject<IdLoggingAudioEncoderFactory>(
|
||||||
webrtc::CreateAudioEncoderFactory<
|
webrtc::CreateAudioEncoderFactory<
|
||||||
AudioEncoderUnicornSparklesRainbow>(),
|
AudioEncoderUnicornSparklesRainbow>(),
|
||||||
@ -486,7 +482,7 @@ TEST_P(PeerConnectionEndToEndTest, CallWithCustomCodec) {
|
|||||||
// Verifies that a DataChannel created before the negotiation can transition to
|
// Verifies that a DataChannel created before the negotiation can transition to
|
||||||
// "OPEN" and transfer data.
|
// "OPEN" and transfer data.
|
||||||
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
|
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -511,7 +507,7 @@ TEST_P(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
|
|||||||
// Verifies that a DataChannel created after the negotiation can transition to
|
// Verifies that a DataChannel created after the negotiation can transition to
|
||||||
// "OPEN" and transfer data.
|
// "OPEN" and transfer data.
|
||||||
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
|
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -543,7 +539,7 @@ TEST_P(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
|
|||||||
|
|
||||||
// Verifies that a DataChannel created can transfer large messages.
|
// Verifies that a DataChannel created can transfer large messages.
|
||||||
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelLargeTransfer) {
|
TEST_P(PeerConnectionEndToEndTest, CreateDataChannelLargeTransfer) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -577,7 +573,7 @@ TEST_P(PeerConnectionEndToEndTest, CreateDataChannelLargeTransfer) {
|
|||||||
|
|
||||||
// Verifies that DataChannel IDs are even/odd based on the DTLS roles.
|
// Verifies that DataChannel IDs are even/odd based on the DTLS roles.
|
||||||
TEST_P(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
|
TEST_P(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -605,7 +601,7 @@ TEST_P(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
|
|||||||
// there are multiple DataChannels.
|
// there are multiple DataChannels.
|
||||||
TEST_P(PeerConnectionEndToEndTest,
|
TEST_P(PeerConnectionEndToEndTest,
|
||||||
MessageTransferBetweenTwoPairsOfDataChannels) {
|
MessageTransferBetweenTwoPairsOfDataChannels) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -645,7 +641,7 @@ TEST_P(PeerConnectionEndToEndTest,
|
|||||||
// channel, and the closed channel was incorrectly still assigned to the ID.
|
// channel, and the closed channel was incorrectly still assigned to the ID.
|
||||||
TEST_P(PeerConnectionEndToEndTest,
|
TEST_P(PeerConnectionEndToEndTest,
|
||||||
DataChannelFromOpenWorksAfterPreviousChannelClosed) {
|
DataChannelFromOpenWorksAfterPreviousChannelClosed) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -678,7 +674,7 @@ TEST_P(PeerConnectionEndToEndTest,
|
|||||||
// closing before creating the second one.
|
// closing before creating the second one.
|
||||||
TEST_P(PeerConnectionEndToEndTest,
|
TEST_P(PeerConnectionEndToEndTest,
|
||||||
DataChannelFromOpenWorksWhilePreviousChannelClosing) {
|
DataChannelFromOpenWorksWhilePreviousChannelClosing) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
@ -709,7 +705,7 @@ TEST_P(PeerConnectionEndToEndTest,
|
|||||||
// reference count), no memory access violation will occur.
|
// reference count), no memory access violation will occur.
|
||||||
// See: https://code.google.com/p/chromium/issues/detail?id=565048
|
// See: https://code.google.com/p/chromium/issues/detail?id=565048
|
||||||
TEST_P(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) {
|
TEST_P(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) {
|
||||||
CreatePcs(nullptr, webrtc::CreateBuiltinAudioEncoderFactory(),
|
CreatePcs(webrtc::CreateBuiltinAudioEncoderFactory(),
|
||||||
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
webrtc::MockAudioDecoderFactory::CreateEmptyFactory());
|
||||||
|
|
||||||
webrtc::DataChannelInit init;
|
webrtc::DataChannelInit init;
|
||||||
|
|||||||
@ -329,23 +329,6 @@ void PeerConnectionFactory::StopAecDump() {
|
|||||||
channel_manager_->StopAecDump();
|
channel_manager_->StopAecDump();
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<PeerConnectionInterface>
|
|
||||||
PeerConnectionFactory::CreatePeerConnection(
|
|
||||||
const PeerConnectionInterface::RTCConfiguration& configuration_in,
|
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
std::unique_ptr<cricket::PortAllocator> allocator,
|
|
||||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
|
||||||
PeerConnectionObserver* observer) {
|
|
||||||
RTC_DCHECK(signaling_thread_->IsCurrent());
|
|
||||||
|
|
||||||
// We merge constraints and configuration into a single configuration.
|
|
||||||
PeerConnectionInterface::RTCConfiguration configuration = configuration_in;
|
|
||||||
CopyConstraintsIntoRtcConfiguration(constraints, &configuration);
|
|
||||||
|
|
||||||
return CreatePeerConnection(configuration, std::move(allocator),
|
|
||||||
std::move(cert_generator), observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
rtc::scoped_refptr<PeerConnectionInterface>
|
rtc::scoped_refptr<PeerConnectionInterface>
|
||||||
PeerConnectionFactory::CreatePeerConnection(
|
PeerConnectionFactory::CreatePeerConnection(
|
||||||
const PeerConnectionInterface::RTCConfiguration& configuration,
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
||||||
|
|||||||
@ -42,14 +42,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
|
|||||||
|
|
||||||
void SetOptions(const Options& options) override;
|
void SetOptions(const Options& options) override;
|
||||||
|
|
||||||
// Deprecated, use version without constraints.
|
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
|
||||||
const PeerConnectionInterface::RTCConfiguration& configuration,
|
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
std::unique_ptr<cricket::PortAllocator> allocator,
|
|
||||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
|
|
||||||
PeerConnectionObserver* observer) override;
|
|
||||||
|
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
|
||||||
const PeerConnectionInterface::RTCConfiguration& configuration,
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
||||||
std::unique_ptr<cricket::PortAllocator> allocator,
|
std::unique_ptr<cricket::PortAllocator> allocator,
|
||||||
|
|||||||
@ -178,7 +178,7 @@ TEST(PeerConnectionFactoryTestInternal, DISABLED_CreatePCUsingInternalModules) {
|
|||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(factory->CreatePeerConnection(
|
||||||
config, nullptr, nullptr, std::move(cert_generator), &observer));
|
config, nullptr, std::move(cert_generator), &observer));
|
||||||
|
|
||||||
EXPECT_TRUE(pc.get() != nullptr);
|
EXPECT_TRUE(pc.get() != nullptr);
|
||||||
}
|
}
|
||||||
@ -264,9 +264,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
cricket::ServerAddresses stun_servers;
|
cricket::ServerAddresses stun_servers;
|
||||||
rtc::SocketAddress stun1("stun.l.google.com", 19302);
|
rtc::SocketAddress stun1("stun.l.google.com", 19302);
|
||||||
@ -294,9 +294,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
cricket::ServerAddresses stun_servers;
|
cricket::ServerAddresses stun_servers;
|
||||||
rtc::SocketAddress stun1("stun.l.google.com", 19302);
|
rtc::SocketAddress stun1("stun.l.google.com", 19302);
|
||||||
@ -323,9 +323,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||||
cricket::RelayServerConfig turn("test.com", 1234, kTurnUsername,
|
cricket::RelayServerConfig turn("test.com", 1234, kTurnUsername,
|
||||||
@ -344,9 +344,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||||
cricket::RelayServerConfig turn("hello.com", kDefaultStunPort, "test",
|
cricket::RelayServerConfig turn("hello.com", kDefaultStunPort, "test",
|
||||||
@ -369,9 +369,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
std::vector<cricket::RelayServerConfig> turn_servers;
|
std::vector<cricket::RelayServerConfig> turn_servers;
|
||||||
cricket::RelayServerConfig turn1("hello.com", kDefaultStunTlsPort, "test",
|
cricket::RelayServerConfig turn1("hello.com", kDefaultStunTlsPort, "test",
|
||||||
@ -404,9 +404,9 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
|
|||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(factory_->CreatePeerConnection(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
config, nullptr, std::move(port_allocator_), std::move(cert_generator),
|
factory_->CreatePeerConnection(config, std::move(port_allocator_),
|
||||||
&observer_));
|
std::move(cert_generator), &observer_));
|
||||||
ASSERT_TRUE(pc.get() != NULL);
|
ASSERT_TRUE(pc.get() != NULL);
|
||||||
cricket::ServerAddresses stun_servers;
|
cricket::ServerAddresses stun_servers;
|
||||||
rtc::SocketAddress stun1("1.2.3.4", 1234);
|
rtc::SocketAddress stun1("1.2.3.4", 1234);
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
#include "api/peerconnectioninterface.h"
|
#include "api/peerconnectioninterface.h"
|
||||||
#include "api/rtpreceiverinterface.h"
|
#include "api/rtpreceiverinterface.h"
|
||||||
#include "api/rtpsenderinterface.h"
|
#include "api/rtpsenderinterface.h"
|
||||||
#include "api/test/fakeconstraints.h"
|
|
||||||
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
||||||
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
||||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||||
@ -417,7 +416,6 @@ using webrtc::AudioTrack;
|
|||||||
using webrtc::AudioTrackInterface;
|
using webrtc::AudioTrackInterface;
|
||||||
using webrtc::DataBuffer;
|
using webrtc::DataBuffer;
|
||||||
using webrtc::DataChannelInterface;
|
using webrtc::DataChannelInterface;
|
||||||
using webrtc::FakeConstraints;
|
|
||||||
using webrtc::IceCandidateInterface;
|
using webrtc::IceCandidateInterface;
|
||||||
using webrtc::MediaConstraintsInterface;
|
using webrtc::MediaConstraintsInterface;
|
||||||
using webrtc::MediaStream;
|
using webrtc::MediaStream;
|
||||||
@ -707,30 +705,23 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CreatePeerConnection() {
|
void CreatePeerConnection() {
|
||||||
CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(), nullptr);
|
CreatePeerConnection(PeerConnectionInterface::RTCConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
// DTLS does not work in a loopback call, so is disabled for most of the
|
// DTLS does not work in a loopback call, so is disabled for most of the
|
||||||
// tests in this file.
|
// tests in this file.
|
||||||
void CreatePeerConnectionWithoutDtls() {
|
void CreatePeerConnectionWithoutDtls() {
|
||||||
FakeConstraints no_dtls_constraints;
|
RTCConfiguration config;
|
||||||
no_dtls_constraints.AddMandatory(
|
config.enable_dtls_srtp = false;
|
||||||
webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false);
|
|
||||||
|
|
||||||
CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(),
|
CreatePeerConnection(config);
|
||||||
&no_dtls_constraints);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatePeerConnection(webrtc::MediaConstraintsInterface* constraints) {
|
|
||||||
CreatePeerConnection(PeerConnectionInterface::RTCConfiguration(),
|
|
||||||
constraints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePeerConnectionWithIceTransportsType(
|
void CreatePeerConnectionWithIceTransportsType(
|
||||||
PeerConnectionInterface::IceTransportsType type) {
|
PeerConnectionInterface::IceTransportsType type) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.type = type;
|
config.type = type;
|
||||||
return CreatePeerConnection(config, nullptr);
|
return CreatePeerConnection(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePeerConnectionWithIceServer(const std::string& uri,
|
void CreatePeerConnectionWithIceServer(const std::string& uri,
|
||||||
@ -740,12 +731,10 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
server.uri = uri;
|
server.uri = uri;
|
||||||
server.password = password;
|
server.password = password;
|
||||||
config.servers.push_back(server);
|
config.servers.push_back(server);
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePeerConnection(
|
void CreatePeerConnection(const RTCConfiguration& config) {
|
||||||
const PeerConnectionInterface::RTCConfiguration& config,
|
|
||||||
webrtc::MediaConstraintsInterface* constraints) {
|
|
||||||
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
|
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
|
||||||
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
|
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
|
||||||
port_allocator_ = port_allocator.get();
|
port_allocator_ = port_allocator.get();
|
||||||
@ -753,19 +742,16 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
// Create certificate generator unless DTLS constraint is explicitly set to
|
// Create certificate generator unless DTLS constraint is explicitly set to
|
||||||
// false.
|
// false.
|
||||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
|
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
|
||||||
bool dtls;
|
|
||||||
if (FindConstraint(constraints,
|
if (config.enable_dtls_srtp.value_or(true)) {
|
||||||
webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
|
||||||
&dtls, nullptr) &&
|
|
||||||
dtls) {
|
|
||||||
fake_certificate_generator_ = new FakeRTCCertificateGenerator();
|
fake_certificate_generator_ = new FakeRTCCertificateGenerator();
|
||||||
cert_generator.reset(fake_certificate_generator_);
|
cert_generator.reset(fake_certificate_generator_);
|
||||||
}
|
}
|
||||||
RTCConfiguration modified_config = config;
|
RTCConfiguration modified_config = config;
|
||||||
modified_config.sdp_semantics = sdp_semantics_;
|
modified_config.sdp_semantics = sdp_semantics_;
|
||||||
pc_ = pc_factory_->CreatePeerConnection(
|
pc_ = pc_factory_->CreatePeerConnection(
|
||||||
modified_config, constraints, std::move(port_allocator),
|
modified_config, std::move(port_allocator), std::move(cert_generator),
|
||||||
std::move(cert_generator), &observer_);
|
&observer_);
|
||||||
ASSERT_TRUE(pc_.get() != NULL);
|
ASSERT_TRUE(pc_.get() != NULL);
|
||||||
observer_.SetPeerConnectionInterface(pc_.get());
|
observer_.SetPeerConnectionInterface(pc_.get());
|
||||||
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
|
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
|
||||||
@ -778,8 +764,7 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
config.servers.push_back(server);
|
config.servers.push_back(server);
|
||||||
config.sdp_semantics = sdp_semantics_;
|
config.sdp_semantics = sdp_semantics_;
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc =
|
rtc::scoped_refptr<PeerConnectionInterface> pc =
|
||||||
pc_factory_->CreatePeerConnection(config, nullptr, nullptr, nullptr,
|
pc_factory_->CreatePeerConnection(config, nullptr, nullptr, &observer_);
|
||||||
&observer_);
|
|
||||||
EXPECT_EQ(nullptr, pc);
|
EXPECT_EQ(nullptr, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,14 +880,14 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DoCreateOfferAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
bool DoCreateOfferAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
||||||
bool offer,
|
const RTCOfferAnswerOptions* options,
|
||||||
MediaConstraintsInterface* constraints) {
|
bool offer) {
|
||||||
rtc::scoped_refptr<MockCreateSessionDescriptionObserver> observer(
|
rtc::scoped_refptr<MockCreateSessionDescriptionObserver> observer(
|
||||||
new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>());
|
new rtc::RefCountedObject<MockCreateSessionDescriptionObserver>());
|
||||||
if (offer) {
|
if (offer) {
|
||||||
pc_->CreateOffer(observer, constraints);
|
pc_->CreateOffer(observer, options ? *options : RTCOfferAnswerOptions());
|
||||||
} else {
|
} else {
|
||||||
pc_->CreateAnswer(observer, constraints);
|
pc_->CreateAnswer(observer, options ? *options : RTCOfferAnswerOptions());
|
||||||
}
|
}
|
||||||
EXPECT_EQ_WAIT(true, observer->called(), kTimeout);
|
EXPECT_EQ_WAIT(true, observer->called(), kTimeout);
|
||||||
*desc = observer->MoveDescription();
|
*desc = observer->MoveDescription();
|
||||||
@ -910,13 +895,13 @@ class PeerConnectionInterfaceBaseTest : public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DoCreateOffer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
bool DoCreateOffer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
||||||
MediaConstraintsInterface* constraints) {
|
const RTCOfferAnswerOptions* options) {
|
||||||
return DoCreateOfferAnswer(desc, true, constraints);
|
return DoCreateOfferAnswer(desc, options, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DoCreateAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
bool DoCreateAnswer(std::unique_ptr<SessionDescriptionInterface>* desc,
|
||||||
MediaConstraintsInterface* constraints) {
|
const RTCOfferAnswerOptions* options) {
|
||||||
return DoCreateOfferAnswer(desc, false, constraints);
|
return DoCreateOfferAnswer(desc, options, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DoSetSessionDescription(
|
bool DoSetSessionDescription(
|
||||||
@ -1359,7 +1344,7 @@ TEST_P(PeerConnectionInterfaceTest, CreatePeerConnectionWithPooledCandidates) {
|
|||||||
config.candidate_network_policy =
|
config.candidate_network_policy =
|
||||||
PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
|
PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
|
||||||
config.ice_candidate_pool_size = 1;
|
config.ice_candidate_pool_size = 1;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
const cricket::FakePortAllocatorSession* session =
|
const cricket::FakePortAllocatorSession* session =
|
||||||
static_cast<const cricket::FakePortAllocatorSession*>(
|
static_cast<const cricket::FakePortAllocatorSession*>(
|
||||||
@ -1411,8 +1396,8 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */,
|
webrtc::CreateBuiltinVideoDecoderFactory(), nullptr /* audio_mixer */,
|
||||||
nullptr /* audio_processing */));
|
nullptr /* audio_processing */));
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
pc_factory->CreatePeerConnection(
|
pc_factory->CreatePeerConnection(config, std::move(port_allocator),
|
||||||
config, nullptr, std::move(port_allocator), nullptr, &observer_));
|
nullptr, &observer_));
|
||||||
|
|
||||||
// Now validate that the config fields set above were applied to the
|
// Now validate that the config fields set above were applied to the
|
||||||
// PortAllocator, as flags or otherwise.
|
// PortAllocator, as flags or otherwise.
|
||||||
@ -1430,7 +1415,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterCreatePeerConnection) {
|
TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterCreatePeerConnection) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.type = PeerConnectionInterface::kRelay;
|
config.type = PeerConnectionInterface::kRelay;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
PeerConnectionInterface::RTCConfiguration returned_config =
|
PeerConnectionInterface::RTCConfiguration returned_config =
|
||||||
pc_->GetConfiguration();
|
pc_->GetConfiguration();
|
||||||
@ -1930,9 +1915,10 @@ TEST_P(PeerConnectionInterfaceTest, GetRTCStatsBeforeAndAfterCalling) {
|
|||||||
|
|
||||||
// This test setup two RTP data channels in loop back.
|
// This test setup two RTP data channels in loop back.
|
||||||
TEST_P(PeerConnectionInterfaceTest, TestDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, TestDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(config);
|
||||||
rtc::scoped_refptr<DataChannelInterface> data1 =
|
rtc::scoped_refptr<DataChannelInterface> data1 =
|
||||||
pc_->CreateDataChannel("test1", NULL);
|
pc_->CreateDataChannel("test1", NULL);
|
||||||
rtc::scoped_refptr<DataChannelInterface> data2 =
|
rtc::scoped_refptr<DataChannelInterface> data2 =
|
||||||
@ -1977,9 +1963,10 @@ TEST_P(PeerConnectionInterfaceTest, TestDataChannel) {
|
|||||||
// This test verifies that sendnig binary data over RTP data channels should
|
// This test verifies that sendnig binary data over RTP data channels should
|
||||||
// fail.
|
// fail.
|
||||||
TEST_P(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(config);
|
||||||
rtc::scoped_refptr<DataChannelInterface> data1 =
|
rtc::scoped_refptr<DataChannelInterface> data1 =
|
||||||
pc_->CreateDataChannel("test1", NULL);
|
pc_->CreateDataChannel("test1", NULL);
|
||||||
rtc::scoped_refptr<DataChannelInterface> data2 =
|
rtc::scoped_refptr<DataChannelInterface> data2 =
|
||||||
@ -2007,9 +1994,10 @@ TEST_P(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
|
|||||||
// This test setup a RTP data channels in loop back and test that a channel is
|
// This test setup a RTP data channels in loop back and test that a channel is
|
||||||
// opened even if the remote end answer with a zero SSRC.
|
// opened even if the remote end answer with a zero SSRC.
|
||||||
TEST_P(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(config);
|
||||||
rtc::scoped_refptr<DataChannelInterface> data1 =
|
rtc::scoped_refptr<DataChannelInterface> data1 =
|
||||||
pc_->CreateDataChannel("test1", NULL);
|
pc_->CreateDataChannel("test1", NULL);
|
||||||
std::unique_ptr<MockDataChannelObserver> observer1(
|
std::unique_ptr<MockDataChannelObserver> observer1(
|
||||||
@ -2029,9 +2017,11 @@ TEST_P(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
|
|||||||
// This test that if a data channel is added in an answer a receive only channel
|
// This test that if a data channel is added in an answer a receive only channel
|
||||||
// channel is created.
|
// channel is created.
|
||||||
TEST_P(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
config.enable_dtls_srtp = false;
|
||||||
|
|
||||||
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
std::string offer_label = "offer_channel";
|
std::string offer_label = "offer_channel";
|
||||||
rtc::scoped_refptr<DataChannelInterface> offer_channel =
|
rtc::scoped_refptr<DataChannelInterface> offer_channel =
|
||||||
@ -2069,9 +2059,9 @@ TEST_P(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
|
|||||||
// requested.
|
// requested.
|
||||||
// TODO(perkj): Remove this test once reliable channels are implemented.
|
// TODO(perkj): Remove this test once reliable channels are implemented.
|
||||||
TEST_P(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
|
TEST_P(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
std::string label = "test";
|
std::string label = "test";
|
||||||
webrtc::DataChannelInit config;
|
webrtc::DataChannelInit config;
|
||||||
@ -2083,9 +2073,9 @@ TEST_P(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
|
|||||||
|
|
||||||
// Verifies that duplicated label is not allowed for RTP data channel.
|
// Verifies that duplicated label is not allowed for RTP data channel.
|
||||||
TEST_P(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
|
TEST_P(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
std::string label = "test";
|
std::string label = "test";
|
||||||
rtc::scoped_refptr<DataChannelInterface> channel =
|
rtc::scoped_refptr<DataChannelInterface> channel =
|
||||||
@ -2100,9 +2090,9 @@ TEST_P(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
|
|||||||
// This tests that a SCTP data channel is returned using different
|
// This tests that a SCTP data channel is returned using different
|
||||||
// DataChannelInit configurations.
|
// DataChannelInit configurations.
|
||||||
TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowDtlsSctpDataChannels();
|
rtc_config.enable_dtls_srtp = true;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
webrtc::DataChannelInit config;
|
webrtc::DataChannelInit config;
|
||||||
|
|
||||||
@ -2138,9 +2128,9 @@ TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
|
|||||||
// maxRetransmitTime are set for SCTP data channels.
|
// maxRetransmitTime are set for SCTP data channels.
|
||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
CreateSctpDataChannelShouldFailForInvalidConfig) {
|
CreateSctpDataChannelShouldFailForInvalidConfig) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowDtlsSctpDataChannels();
|
rtc_config.enable_dtls_srtp = true;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
std::string label = "test";
|
std::string label = "test";
|
||||||
webrtc::DataChannelInit config;
|
webrtc::DataChannelInit config;
|
||||||
@ -2156,9 +2146,9 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
// or out of range should fail.
|
// or out of range should fail.
|
||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
CreateSctpDataChannelWithInvalidIdShouldFail) {
|
CreateSctpDataChannelWithInvalidIdShouldFail) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowDtlsSctpDataChannels();
|
rtc_config.enable_dtls_srtp = true;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
webrtc::DataChannelInit config;
|
webrtc::DataChannelInit config;
|
||||||
rtc::scoped_refptr<DataChannelInterface> channel;
|
rtc::scoped_refptr<DataChannelInterface> channel;
|
||||||
@ -2183,10 +2173,9 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
|
|
||||||
// Verifies that duplicated label is allowed for SCTP data channel.
|
// Verifies that duplicated label is allowed for SCTP data channel.
|
||||||
TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
|
TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(rtc_config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
std::string label = "test";
|
std::string label = "test";
|
||||||
rtc::scoped_refptr<DataChannelInterface> channel =
|
rtc::scoped_refptr<DataChannelInterface> channel =
|
||||||
@ -2201,9 +2190,10 @@ TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
|
|||||||
// This test verifies that OnRenegotiationNeeded is fired for every new RTP
|
// This test verifies that OnRenegotiationNeeded is fired for every new RTP
|
||||||
// DataChannel.
|
// DataChannel.
|
||||||
TEST_P(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
|
TEST_P(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
rtc_config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
rtc::scoped_refptr<DataChannelInterface> dc1 =
|
rtc::scoped_refptr<DataChannelInterface> dc1 =
|
||||||
pc_->CreateDataChannel("test1", NULL);
|
pc_->CreateDataChannel("test1", NULL);
|
||||||
@ -2217,9 +2207,10 @@ TEST_P(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
|
|||||||
|
|
||||||
// This test that a data channel closes when a PeerConnection is deleted/closed.
|
// This test that a data channel closes when a PeerConnection is deleted/closed.
|
||||||
TEST_P(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
|
TEST_P(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
rtc_config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
rtc::scoped_refptr<DataChannelInterface> data1 =
|
rtc::scoped_refptr<DataChannelInterface> data1 =
|
||||||
pc_->CreateDataChannel("test1", NULL);
|
pc_->CreateDataChannel("test1", NULL);
|
||||||
@ -2242,9 +2233,10 @@ TEST_P(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
|
|||||||
|
|
||||||
// This tests that RTP data channels can be rejected in an answer.
|
// This tests that RTP data channels can be rejected in an answer.
|
||||||
TEST_P(PeerConnectionInterfaceTest, TestRejectRtpDataChannelInAnswer) {
|
TEST_P(PeerConnectionInterfaceTest, TestRejectRtpDataChannelInAnswer) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.SetAllowRtpDataChannels();
|
rtc_config.enable_rtp_data_channel = true;
|
||||||
CreatePeerConnection(&constraints);
|
rtc_config.enable_dtls_srtp = false;
|
||||||
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
rtc::scoped_refptr<DataChannelInterface> offer_channel(
|
rtc::scoped_refptr<DataChannelInterface> offer_channel(
|
||||||
pc_->CreateDataChannel("offer_channel", NULL));
|
pc_->CreateDataChannel("offer_channel", NULL));
|
||||||
@ -2272,8 +2264,8 @@ TEST_P(PeerConnectionInterfaceTest, TestRejectSctpDataChannelInAnswer)
|
|||||||
TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer)
|
TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
CreatePeerConnection(&constraints);
|
CreatePeerConnection(rtc_config);
|
||||||
|
|
||||||
rtc::scoped_refptr<DataChannelInterface> offer_channel(
|
rtc::scoped_refptr<DataChannelInterface> offer_channel(
|
||||||
pc_->CreateDataChannel("offer_channel", NULL));
|
pc_->CreateDataChannel("offer_channel", NULL));
|
||||||
@ -2298,10 +2290,9 @@ TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer)
|
|||||||
// FireFox, use it as a remote session description, generate an answer and use
|
// FireFox, use it as a remote session description, generate an answer and use
|
||||||
// the answer as a local description.
|
// the answer as a local description.
|
||||||
TEST_P(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
|
TEST_P(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(rtc_config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
AddAudioTrack("audio_label");
|
AddAudioTrack("audio_label");
|
||||||
AddVideoTrack("video_label");
|
AddVideoTrack("video_label");
|
||||||
std::unique_ptr<SessionDescriptionInterface> desc(
|
std::unique_ptr<SessionDescriptionInterface> desc(
|
||||||
@ -2333,10 +2324,9 @@ TEST_P(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
|
|||||||
// The fallback was previously supported but was removed to simplify the code
|
// The fallback was previously supported but was removed to simplify the code
|
||||||
// and because it's non-standard.
|
// and because it's non-standard.
|
||||||
TEST_P(PeerConnectionInterfaceTest, DtlsSdesFallbackNotSupported) {
|
TEST_P(PeerConnectionInterfaceTest, DtlsSdesFallbackNotSupported) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(rtc_config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
// Wait for fake certificate to be generated. Previously, this is what caused
|
// Wait for fake certificate to be generated. Previously, this is what caused
|
||||||
// the "a=crypto" lines to be rejected.
|
// the "a=crypto" lines to be rejected.
|
||||||
AddAudioTrack("audio_label");
|
AddAudioTrack("audio_label");
|
||||||
@ -2378,10 +2368,9 @@ TEST_P(PeerConnectionInterfaceTest, ReceiveUpdatedAudioOfferWithBadCodecs) {
|
|||||||
// Test that if we're receiving (but not sending) a track, subsequent offers
|
// Test that if we're receiving (but not sending) a track, subsequent offers
|
||||||
// will have m-lines with a=recvonly.
|
// will have m-lines with a=recvonly.
|
||||||
TEST_P(PeerConnectionInterfaceTest, CreateSubsequentRecvOnlyOffer) {
|
TEST_P(PeerConnectionInterfaceTest, CreateSubsequentRecvOnlyOffer) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(rtc_config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
CreateAnswerAsLocalDescription();
|
CreateAnswerAsLocalDescription();
|
||||||
|
|
||||||
@ -2405,10 +2394,9 @@ TEST_P(PeerConnectionInterfaceTest, CreateSubsequentRecvOnlyOffer) {
|
|||||||
// offerToReceiveVideo/offerToReceiveAudio constraints are explicitly set to
|
// offerToReceiveVideo/offerToReceiveAudio constraints are explicitly set to
|
||||||
// false, the generated m-lines will be a=inactive.
|
// false, the generated m-lines will be a=inactive.
|
||||||
TEST_P(PeerConnectionInterfaceTest, CreateSubsequentInactiveOffer) {
|
TEST_P(PeerConnectionInterfaceTest, CreateSubsequentInactiveOffer) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration rtc_config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
rtc_config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(rtc_config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
CreateAnswerAsLocalDescription();
|
CreateAnswerAsLocalDescription();
|
||||||
|
|
||||||
@ -2416,12 +2404,10 @@ TEST_P(PeerConnectionInterfaceTest, CreateSubsequentInactiveOffer) {
|
|||||||
// A new offer would be recvonly, but we'll set the "no receive" constraints
|
// A new offer would be recvonly, but we'll set the "no receive" constraints
|
||||||
// to make it inactive.
|
// to make it inactive.
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
FakeConstraints offer_constraints;
|
RTCOfferAnswerOptions options;
|
||||||
offer_constraints.AddMandatory(
|
options.offer_to_receive_audio = 0;
|
||||||
webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, false);
|
options.offer_to_receive_video = 0;
|
||||||
offer_constraints.AddMandatory(
|
DoCreateOffer(&offer, &options);
|
||||||
webrtc::MediaConstraintsInterface::kOfferToReceiveAudio, false);
|
|
||||||
DoCreateOffer(&offer, &offer_constraints);
|
|
||||||
|
|
||||||
const cricket::ContentInfo* video_content =
|
const cricket::ContentInfo* video_content =
|
||||||
cricket::GetFirstVideoContent(offer->description());
|
cricket::GetFirstVideoContent(offer->description());
|
||||||
@ -2461,7 +2447,7 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesCandidateFilter) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
|
TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.prune_turn_ports = false;
|
config.prune_turn_ports = false;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
EXPECT_FALSE(port_allocator_->prune_turn_ports());
|
EXPECT_FALSE(port_allocator_->prune_turn_ports());
|
||||||
|
|
||||||
@ -2476,7 +2462,7 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesIceCheckInterval) {
|
TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesIceCheckInterval) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.ice_check_min_interval = absl::nullopt;
|
config.ice_check_min_interval = absl::nullopt;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
config.ice_check_min_interval = 100;
|
config.ice_check_min_interval = 100;
|
||||||
EXPECT_TRUE(pc_->SetConfiguration(config));
|
EXPECT_TRUE(pc_->SetConfiguration(config));
|
||||||
@ -2573,7 +2559,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced;
|
config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced;
|
||||||
config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
|
config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
|
||||||
config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE;
|
config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
PeerConnectionInterface::RTCConfiguration modified_config =
|
PeerConnectionInterface::RTCConfiguration modified_config =
|
||||||
pc_->GetConfiguration();
|
pc_->GetConfiguration();
|
||||||
@ -2603,7 +2589,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
SetConfigurationReturnsRangeErrorForBadCandidatePoolSize) {
|
SetConfigurationReturnsRangeErrorForBadCandidatePoolSize) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
|
|
||||||
config.ice_candidate_pool_size = -1;
|
config.ice_candidate_pool_size = -1;
|
||||||
@ -2622,7 +2608,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
SetConfigurationReturnsSyntaxErrorFromBadIceUrls) {
|
SetConfigurationReturnsSyntaxErrorFromBadIceUrls) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
|
|
||||||
PeerConnectionInterface::IceServer bad_server;
|
PeerConnectionInterface::IceServer bad_server;
|
||||||
@ -2638,7 +2624,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
SetConfigurationReturnsInvalidParameterIfCredentialsMissing) {
|
SetConfigurationReturnsInvalidParameterIfCredentialsMissing) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
|
|
||||||
PeerConnectionInterface::IceServer bad_server;
|
PeerConnectionInterface::IceServer bad_server;
|
||||||
@ -2753,10 +2739,9 @@ TEST_P(PeerConnectionInterfaceTest, CloseAndGetStats) {
|
|||||||
// SDP string is created. In this test the two separate MediaStreams are
|
// SDP string is created. In this test the two separate MediaStreams are
|
||||||
// signaled.
|
// signaled.
|
||||||
TEST_P(PeerConnectionInterfaceTest, UpdateRemoteStreams) {
|
TEST_P(PeerConnectionInterfaceTest, UpdateRemoteStreams) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
|
|
||||||
rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
|
rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
|
||||||
@ -2780,10 +2765,9 @@ TEST_P(PeerConnectionInterfaceTest, UpdateRemoteStreams) {
|
|||||||
// specific behavior.
|
// specific behavior.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
AddRemoveTrackFromExistingRemoteMediaStream) {
|
AddRemoveTrackFromExistingRemoteMediaStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
std::unique_ptr<SessionDescriptionInterface> desc_ms1 =
|
std::unique_ptr<SessionDescriptionInterface> desc_ms1 =
|
||||||
CreateSessionDescriptionAndReference(1, 1);
|
CreateSessionDescriptionAndReference(1, 1);
|
||||||
EXPECT_TRUE(DoSetRemoteDescription(std::move(desc_ms1)));
|
EXPECT_TRUE(DoSetRemoteDescription(std::move(desc_ms1)));
|
||||||
@ -2824,10 +2808,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// This tests that remote tracks are ended if a local session description is set
|
// This tests that remote tracks are ended if a local session description is set
|
||||||
// that rejects the media content type.
|
// that rejects the media content type.
|
||||||
TEST_P(PeerConnectionInterfaceTest, RejectMediaContent) {
|
TEST_P(PeerConnectionInterfaceTest, RejectMediaContent) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
// First create and set a remote offer, then reject its video content in our
|
// First create and set a remote offer, then reject its video content in our
|
||||||
// answer.
|
// answer.
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithStream1PlanB);
|
CreateAndSetRemoteOffer(kSdpStringWithStream1PlanB);
|
||||||
@ -2874,10 +2857,9 @@ TEST_P(PeerConnectionInterfaceTest, RejectMediaContent) {
|
|||||||
// of PeerConnection and then PeerConnection tries to reject the track.
|
// of PeerConnection and then PeerConnection tries to reject the track.
|
||||||
// Don't run under Unified Plan since the stream API is not available.
|
// Don't run under Unified Plan since the stream API is not available.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, RemoveTrackThenRejectMediaContent) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, RemoveTrackThenRejectMediaContent) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
|
MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
|
||||||
remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]);
|
remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]);
|
||||||
@ -2901,10 +2883,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, RemoveTrackThenRejectMediaContent) {
|
|||||||
// will be created, even if the description contains SSRCs/MSIDs.
|
// will be created, even if the description contains SSRCs/MSIDs.
|
||||||
// See: https://code.google.com/p/webrtc/issues/detail?id=5054
|
// See: https://code.google.com/p/webrtc/issues/detail?id=5054
|
||||||
TEST_P(PeerConnectionInterfaceTest, RecvonlyDescriptionDoesntCreateStream) {
|
TEST_P(PeerConnectionInterfaceTest, RecvonlyDescriptionDoesntCreateStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
std::string recvonly_offer = GetSdpStringWithStream1();
|
std::string recvonly_offer = GetSdpStringWithStream1();
|
||||||
rtc::replace_substrs(kSendrecv, strlen(kSendrecv), kRecvonly,
|
rtc::replace_substrs(kSendrecv, strlen(kSendrecv), kRecvonly,
|
||||||
@ -2920,10 +2901,9 @@ TEST_P(PeerConnectionInterfaceTest, RecvonlyDescriptionDoesntCreateStream) {
|
|||||||
// in a subsequent session description.
|
// in a subsequent session description.
|
||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithoutMsidCreatesDefaultStream) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithoutMsidCreatesDefaultStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
|
CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
|
||||||
|
|
||||||
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
||||||
@ -2950,10 +2930,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithoutMsidCreatesDefaultStream) {
|
|||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
SendOnlySdpWithoutMsidCreatesDefaultStream) {
|
SendOnlySdpWithoutMsidCreatesDefaultStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringSendOnlyWithoutStreams);
|
CreateAndSetRemoteOffer(kSdpStringSendOnlyWithoutStreams);
|
||||||
|
|
||||||
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
||||||
@ -2968,10 +2947,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// a remote track that as already been removed from the MediaStream.
|
// a remote track that as already been removed from the MediaStream.
|
||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, RemoveAlreadyGoneRemoteStream) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, RemoveAlreadyGoneRemoteStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
|
MediaStreamInterface* remote_stream = observer_.remote_streams()->at(0);
|
||||||
remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
|
remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
|
||||||
@ -2988,10 +2966,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, RemoveAlreadyGoneRemoteStream) {
|
|||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
SdpWithoutMsidAndStreamsCreatesDefaultStream) {
|
SdpWithoutMsidAndStreamsCreatesDefaultStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithoutStreams);
|
CreateAndSetRemoteOffer(kSdpStringWithoutStreams);
|
||||||
|
|
||||||
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
||||||
@ -3004,10 +2981,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// description doesn't contain any streams but does support MSID.
|
// description doesn't contain any streams but does support MSID.
|
||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithMsidDontCreatesDefaultStream) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithMsidDontCreatesDefaultStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithMsidWithoutStreams);
|
CreateAndSetRemoteOffer(kSdpStringWithMsidWithoutStreams);
|
||||||
EXPECT_EQ(0u, observer_.remote_streams()->count());
|
EXPECT_EQ(0u, observer_.remote_streams()->count());
|
||||||
}
|
}
|
||||||
@ -3018,10 +2994,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, SdpWithMsidDontCreatesDefaultStream) {
|
|||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
DefaultTracksNotDestroyedAndRecreated) {
|
DefaultTracksNotDestroyedAndRecreated) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
|
CreateAndSetRemoteOffer(kSdpStringWithoutStreamsAudioOnly);
|
||||||
|
|
||||||
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
ASSERT_EQ(1u, observer_.remote_streams()->count());
|
||||||
@ -3040,10 +3015,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// description is updated to not have any MediaStreams.
|
// description is updated to not have any MediaStreams.
|
||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, VerifyDefaultStreamIsNotCreated) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, VerifyDefaultStreamIsNotCreated) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
CreateAndSetRemoteOffer(GetSdpStringWithStream1());
|
||||||
rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
|
rtc::scoped_refptr<StreamCollection> reference(CreateStreamCollection(1, 1));
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
@ -3057,10 +3031,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, VerifyDefaultStreamIsNotCreated) {
|
|||||||
// an endpoint that doesn't signal SSRCs, but signals media stream IDs.
|
// an endpoint that doesn't signal SSRCs, but signals media stream IDs.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
SdpWithMsidWithoutSsrcCreatesDefaultStream) {
|
SdpWithMsidWithoutSsrcCreatesDefaultStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
std::string sdp_string = kSdpStringWithoutStreamsAudioOnly;
|
std::string sdp_string = kSdpStringWithoutStreamsAudioOnly;
|
||||||
// Add a=msid lines to simulate a Unified Plan endpoint that only
|
// Add a=msid lines to simulate a Unified Plan endpoint that only
|
||||||
// signals stream IDs with a=msid lines.
|
// signals stream IDs with a=msid lines.
|
||||||
@ -3081,10 +3054,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// a=ssrc msid and a=msid lines for interop signaling with Plan B.
|
// a=ssrc msid and a=msid lines for interop signaling with Plan B.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
SdpWithEmptyMsidAndSsrcCreatesDefaultStreamId) {
|
SdpWithEmptyMsidAndSsrcCreatesDefaultStreamId) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
// Add a a=msid line to the SDP. This is prioritized when parsing the SDP, so
|
// Add a a=msid line to the SDP. This is prioritized when parsing the SDP, so
|
||||||
// the sender's stream ID will be interpreted as no stream IDs.
|
// the sender's stream ID will be interpreted as no stream IDs.
|
||||||
std::string sdp_string = kSdpStringWithStream1AudioTrackOnly;
|
std::string sdp_string = kSdpStringWithStream1AudioTrackOnly;
|
||||||
@ -3120,10 +3092,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// an RtpSender's lifetime isn't determined by when a local description is set.
|
// an RtpSender's lifetime isn't determined by when a local description is set.
|
||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB, LocalDescriptionChanged) {
|
TEST_F(PeerConnectionInterfaceTestPlanB, LocalDescriptionChanged) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
// Create an offer with 1 stream with 2 tracks of each type.
|
// Create an offer with 1 stream with 2 tracks of each type.
|
||||||
rtc::scoped_refptr<StreamCollection> stream_collection =
|
rtc::scoped_refptr<StreamCollection> stream_collection =
|
||||||
@ -3160,10 +3131,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB, LocalDescriptionChanged) {
|
|||||||
// Don't run under Unified Plan since this behavior is Plan B specific.
|
// Don't run under Unified Plan since this behavior is Plan B specific.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
AddLocalStreamAfterLocalDescriptionChanged) {
|
AddLocalStreamAfterLocalDescriptionChanged) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
rtc::scoped_refptr<StreamCollection> stream_collection =
|
rtc::scoped_refptr<StreamCollection> stream_collection =
|
||||||
CreateStreamCollection(1, 2);
|
CreateStreamCollection(1, 2);
|
||||||
@ -3190,10 +3160,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
// changed when SetLocalDescription is called.
|
// changed when SetLocalDescription is called.
|
||||||
TEST_P(PeerConnectionInterfaceTest,
|
TEST_P(PeerConnectionInterfaceTest,
|
||||||
ChangeSsrcOnTrackInLocalSessionDescription) {
|
ChangeSsrcOnTrackInLocalSessionDescription) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
AddAudioTrack(kAudioTracks[0]);
|
AddAudioTrack(kAudioTracks[0]);
|
||||||
AddVideoTrack(kVideoTracks[0]);
|
AddVideoTrack(kVideoTracks[0]);
|
||||||
@ -3245,10 +3214,9 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
// Don't run under Unified Plan since the stream API is not available.
|
// Don't run under Unified Plan since the stream API is not available.
|
||||||
TEST_F(PeerConnectionInterfaceTestPlanB,
|
TEST_F(PeerConnectionInterfaceTestPlanB,
|
||||||
SignalSameTracksInSeparateMediaStream) {
|
SignalSameTracksInSeparateMediaStream) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
|
|
||||||
rtc::scoped_refptr<StreamCollection> stream_collection =
|
rtc::scoped_refptr<StreamCollection> stream_collection =
|
||||||
CreateStreamCollection(2, 1);
|
CreateStreamCollection(2, 1);
|
||||||
@ -3283,10 +3251,9 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
|
|
||||||
// This tests that PeerConnectionObserver::OnAddTrack is correctly called.
|
// This tests that PeerConnectionObserver::OnAddTrack is correctly called.
|
||||||
TEST_P(PeerConnectionInterfaceTest, OnAddTrackCallback) {
|
TEST_P(PeerConnectionInterfaceTest, OnAddTrackCallback) {
|
||||||
FakeConstraints constraints;
|
RTCConfiguration config;
|
||||||
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
|
config.enable_dtls_srtp = true;
|
||||||
true);
|
CreatePeerConnection(config);
|
||||||
CreatePeerConnection(&constraints);
|
|
||||||
CreateAndSetRemoteOffer(kSdpStringWithStream1AudioTrackOnly);
|
CreateAndSetRemoteOffer(kSdpStringWithStream1AudioTrackOnly);
|
||||||
EXPECT_EQ(observer_.num_added_tracks_, 1);
|
EXPECT_EQ(observer_.num_added_tracks_, 1);
|
||||||
EXPECT_EQ(observer_.last_added_track_label_, kAudioTracks[0]);
|
EXPECT_EQ(observer_.last_added_track_label_, kAudioTracks[0]);
|
||||||
@ -3302,9 +3269,7 @@ TEST_P(PeerConnectionInterfaceTest, OnAddTrackCallback) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingIceRestart) {
|
TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingIceRestart) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.type = PeerConnectionInterface::kRelay;
|
config.type = PeerConnectionInterface::kRelay;
|
||||||
// Need to pass default constraints to prevent disabling of DTLS...
|
CreatePeerConnection(config);
|
||||||
FakeConstraints default_constraints;
|
|
||||||
CreatePeerConnection(config, &default_constraints);
|
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
AddAudioTrack(kAudioTracks[0], {kStreamId1});
|
AddAudioTrack(kAudioTracks[0], {kStreamId1});
|
||||||
AddVideoTrack(kVideoTracks[0], {kStreamId1});
|
AddVideoTrack(kVideoTracks[0], {kStreamId1});
|
||||||
@ -3338,9 +3303,7 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingIceRestart) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationNotCausingIceRestart) {
|
TEST_P(PeerConnectionInterfaceTest, SetConfigurationNotCausingIceRestart) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.type = PeerConnectionInterface::kRelay;
|
config.type = PeerConnectionInterface::kRelay;
|
||||||
// Need to pass default constraints to prevent disabling of DTLS...
|
CreatePeerConnection(config);
|
||||||
FakeConstraints default_constraints;
|
|
||||||
CreatePeerConnection(config, &default_constraints);
|
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
AddAudioTrack(kAudioTracks[0]);
|
AddAudioTrack(kAudioTracks[0]);
|
||||||
AddVideoTrack(kVideoTracks[0]);
|
AddVideoTrack(kVideoTracks[0]);
|
||||||
@ -3374,9 +3337,7 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationNotCausingIceRestart) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingPartialIceRestart) {
|
TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingPartialIceRestart) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.type = PeerConnectionInterface::kRelay;
|
config.type = PeerConnectionInterface::kRelay;
|
||||||
// Need to pass default constraints to prevent disabling of DTLS...
|
CreatePeerConnection(config);
|
||||||
FakeConstraints default_constraints;
|
|
||||||
CreatePeerConnection(config, &default_constraints);
|
|
||||||
config = pc_->GetConfiguration();
|
config = pc_->GetConfiguration();
|
||||||
AddAudioTrack(kAudioTracks[0], {kStreamId1});
|
AddAudioTrack(kAudioTracks[0], {kStreamId1});
|
||||||
AddVideoTrack(kVideoTracks[0], {kStreamId1});
|
AddVideoTrack(kVideoTracks[0], {kStreamId1});
|
||||||
@ -3534,11 +3495,11 @@ TEST_P(PeerConnectionInterfaceTest, OffersAndAnswersHaveTrickleIceOption) {
|
|||||||
CreatePeerConnection();
|
CreatePeerConnection();
|
||||||
|
|
||||||
// First, create an offer with audio/video.
|
// First, create an offer with audio/video.
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio = 1;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
options.offer_to_receive_video = 1;
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
|
ASSERT_TRUE(DoCreateOffer(&offer, &options));
|
||||||
cricket::SessionDescription* desc = offer->description();
|
cricket::SessionDescription* desc = offer->description();
|
||||||
ASSERT_EQ(2u, desc->transport_infos().size());
|
ASSERT_EQ(2u, desc->transport_infos().size());
|
||||||
EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
|
EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
|
||||||
@ -3547,7 +3508,7 @@ TEST_P(PeerConnectionInterfaceTest, OffersAndAnswersHaveTrickleIceOption) {
|
|||||||
// Apply the offer as a remote description, then create an answer.
|
// Apply the offer as a remote description, then create an answer.
|
||||||
EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
|
EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
|
||||||
std::unique_ptr<SessionDescriptionInterface> answer;
|
std::unique_ptr<SessionDescriptionInterface> answer;
|
||||||
ASSERT_TRUE(DoCreateAnswer(&answer, &constraints));
|
ASSERT_TRUE(DoCreateAnswer(&answer, &options));
|
||||||
desc = answer->description();
|
desc = answer->description();
|
||||||
ASSERT_EQ(2u, desc->transport_infos().size());
|
ASSERT_EQ(2u, desc->transport_infos().size());
|
||||||
EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
|
EXPECT_TRUE(desc->transport_infos()[0].description.HasOption("trickle"));
|
||||||
@ -3559,7 +3520,7 @@ TEST_P(PeerConnectionInterfaceTest, OffersAndAnswersHaveTrickleIceOption) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, IceRenominationNotOffered) {
|
TEST_P(PeerConnectionInterfaceTest, IceRenominationNotOffered) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.enable_ice_renomination = false;
|
config.enable_ice_renomination = false;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
AddAudioTrack("foo");
|
AddAudioTrack("foo");
|
||||||
|
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
@ -3575,7 +3536,7 @@ TEST_P(PeerConnectionInterfaceTest, IceRenominationNotOffered) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, IceRenominationOptionInOfferAndAnswer) {
|
TEST_P(PeerConnectionInterfaceTest, IceRenominationOptionInOfferAndAnswer) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.enable_ice_renomination = true;
|
config.enable_ice_renomination = true;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
AddAudioTrack("foo");
|
AddAudioTrack("foo");
|
||||||
|
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
@ -3602,11 +3563,11 @@ TEST_P(PeerConnectionInterfaceTest, IceRenominationOptionInOfferAndAnswer) {
|
|||||||
TEST_P(PeerConnectionInterfaceTest, CreateOfferWithOfferToReceiveConstraints) {
|
TEST_P(PeerConnectionInterfaceTest, CreateOfferWithOfferToReceiveConstraints) {
|
||||||
CreatePeerConnection();
|
CreatePeerConnection();
|
||||||
|
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio = 1;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
options.offer_to_receive_video = 1;
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
|
ASSERT_TRUE(DoCreateOffer(&offer, &options));
|
||||||
|
|
||||||
cricket::SessionDescription* desc = offer->description();
|
cricket::SessionDescription* desc = offer->description();
|
||||||
const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
|
const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
|
||||||
@ -3627,18 +3588,18 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
|
|||||||
|
|
||||||
// First, create an offer with audio/video and apply it as a remote
|
// First, create an offer with audio/video and apply it as a remote
|
||||||
// description.
|
// description.
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio = 1;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
options.offer_to_receive_video = 1;
|
||||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||||
ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
|
ASSERT_TRUE(DoCreateOffer(&offer, &options));
|
||||||
EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
|
EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
|
||||||
|
|
||||||
// Now create answer that rejects audio/video.
|
// Now create answer that rejects audio/video.
|
||||||
constraints.SetMandatoryReceiveAudio(false);
|
options.offer_to_receive_audio = 0;
|
||||||
constraints.SetMandatoryReceiveVideo(false);
|
options.offer_to_receive_video = 0;
|
||||||
std::unique_ptr<SessionDescriptionInterface> answer;
|
std::unique_ptr<SessionDescriptionInterface> answer;
|
||||||
ASSERT_TRUE(DoCreateAnswer(&answer, &constraints));
|
ASSERT_TRUE(DoCreateAnswer(&answer, &options));
|
||||||
|
|
||||||
cricket::SessionDescription* desc = answer->description();
|
cricket::SessionDescription* desc = answer->description();
|
||||||
const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
|
const cricket::ContentInfo* audio = cricket::GetFirstAudioContent(desc);
|
||||||
@ -3659,7 +3620,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
#endif // HAVE_SCTP
|
#endif // HAVE_SCTP
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
config.bundle_policy = PeerConnectionInterface::kBundlePolicyMaxBundle;
|
config.bundle_policy = PeerConnectionInterface::kBundlePolicyMaxBundle;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
|
|
||||||
// First, create an offer with only a data channel and apply it as a remote
|
// First, create an offer with only a data channel and apply it as a remote
|
||||||
// description.
|
// description.
|
||||||
@ -3745,7 +3706,7 @@ TEST_P(PeerConnectionInterfaceTest,
|
|||||||
config.ice_regather_interval_range.emplace(1000, 2000);
|
config.ice_regather_interval_range.emplace(1000, 2000);
|
||||||
config.continual_gathering_policy =
|
config.continual_gathering_policy =
|
||||||
PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY;
|
PeerConnectionInterface::ContinualGatheringPolicy::GATHER_CONTINUALLY;
|
||||||
CreatePeerConnection(config, nullptr);
|
CreatePeerConnection(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The current bitrate from BitrateSettings is currently clamped
|
// The current bitrate from BitrateSettings is currently clamped
|
||||||
@ -3990,10 +3951,9 @@ class PeerConnectionMediaConfigTest : public testing::Test {
|
|||||||
pcf_->Initialize();
|
pcf_->Initialize();
|
||||||
}
|
}
|
||||||
const cricket::MediaConfig TestCreatePeerConnection(
|
const cricket::MediaConfig TestCreatePeerConnection(
|
||||||
const PeerConnectionInterface::RTCConfiguration& config,
|
const RTCConfiguration& config) {
|
||||||
const MediaConstraintsInterface* constraints) {
|
rtc::scoped_refptr<PeerConnectionInterface> pc(
|
||||||
rtc::scoped_refptr<PeerConnectionInterface> pc(pcf_->CreatePeerConnection(
|
pcf_->CreatePeerConnection(config, nullptr, nullptr, &observer_));
|
||||||
config, constraints, nullptr, nullptr, &observer_));
|
|
||||||
EXPECT_TRUE(pc.get());
|
EXPECT_TRUE(pc.get());
|
||||||
return pc->GetConfiguration().media_config;
|
return pc->GetConfiguration().media_config;
|
||||||
}
|
}
|
||||||
@ -4006,10 +3966,8 @@ class PeerConnectionMediaConfigTest : public testing::Test {
|
|||||||
// default RTCConfiguration.
|
// default RTCConfiguration.
|
||||||
TEST_F(PeerConnectionMediaConfigTest, TestDefaults) {
|
TEST_F(PeerConnectionMediaConfigTest, TestDefaults) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
const cricket::MediaConfig& media_config =
|
const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_FALSE(media_config.enable_dscp);
|
EXPECT_FALSE(media_config.enable_dscp);
|
||||||
EXPECT_TRUE(media_config.video.enable_cpu_adaptation);
|
EXPECT_TRUE(media_config.video.enable_cpu_adaptation);
|
||||||
@ -4018,42 +3976,13 @@ TEST_F(PeerConnectionMediaConfigTest, TestDefaults) {
|
|||||||
EXPECT_FALSE(media_config.video.experiment_cpu_load_estimator);
|
EXPECT_FALSE(media_config.video.experiment_cpu_load_estimator);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test verifies the DSCP constraint is recognized and passed to
|
|
||||||
// the PeerConnection.
|
|
||||||
TEST_F(PeerConnectionMediaConfigTest, TestDscpConstraintTrue) {
|
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDscp, true);
|
|
||||||
const cricket::MediaConfig& media_config =
|
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_TRUE(media_config.enable_dscp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test verifies the cpu overuse detection constraint is
|
|
||||||
// recognized and passed to the PeerConnection.
|
|
||||||
TEST_F(PeerConnectionMediaConfigTest, TestCpuOveruseConstraintFalse) {
|
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
constraints.AddOptional(
|
|
||||||
webrtc::MediaConstraintsInterface::kCpuOveruseDetection, false);
|
|
||||||
const cricket::MediaConfig media_config =
|
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_FALSE(media_config.video.enable_cpu_adaptation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This test verifies that the enable_prerenderer_smoothing flag is
|
// This test verifies that the enable_prerenderer_smoothing flag is
|
||||||
// propagated from RTCConfiguration to the PeerConnection.
|
// propagated from RTCConfiguration to the PeerConnection.
|
||||||
TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
|
TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
config.set_prerenderer_smoothing(false);
|
config.set_prerenderer_smoothing(false);
|
||||||
const cricket::MediaConfig& media_config =
|
const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_FALSE(media_config.video.enable_prerenderer_smoothing);
|
EXPECT_FALSE(media_config.video.enable_prerenderer_smoothing);
|
||||||
}
|
}
|
||||||
@ -4062,31 +3991,13 @@ TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
|
|||||||
// propagated from RTCConfiguration to the PeerConnection.
|
// propagated from RTCConfiguration to the PeerConnection.
|
||||||
TEST_F(PeerConnectionMediaConfigTest, TestEnableExperimentCpuLoadEstimator) {
|
TEST_F(PeerConnectionMediaConfigTest, TestEnableExperimentCpuLoadEstimator) {
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
PeerConnectionInterface::RTCConfiguration config;
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
config.set_experiment_cpu_load_estimator(true);
|
config.set_experiment_cpu_load_estimator(true);
|
||||||
const cricket::MediaConfig& media_config =
|
const cricket::MediaConfig& media_config = TestCreatePeerConnection(config);
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_TRUE(media_config.video.experiment_cpu_load_estimator);
|
EXPECT_TRUE(media_config.video.experiment_cpu_load_estimator);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test verifies the suspend below min bitrate constraint is
|
|
||||||
// recognized and passed to the PeerConnection.
|
|
||||||
TEST_F(PeerConnectionMediaConfigTest,
|
|
||||||
TestSuspendBelowMinBitrateConstraintTrue) {
|
|
||||||
PeerConnectionInterface::RTCConfiguration config;
|
|
||||||
FakeConstraints constraints;
|
|
||||||
|
|
||||||
constraints.AddOptional(
|
|
||||||
webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
|
|
||||||
true);
|
|
||||||
const cricket::MediaConfig media_config =
|
|
||||||
TestCreatePeerConnection(config, &constraints);
|
|
||||||
|
|
||||||
EXPECT_TRUE(media_config.video.suspend_below_min_bitrate);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests a few random fields being different.
|
// Tests a few random fields being different.
|
||||||
TEST(RTCConfigurationTest, ComparisonOperators) {
|
TEST(RTCConfigurationTest, ComparisonOperators) {
|
||||||
PeerConnectionInterface::RTCConfiguration a;
|
PeerConnectionInterface::RTCConfiguration a;
|
||||||
|
|||||||
@ -109,11 +109,9 @@ class RTCStatsIntegrationTest : public testing::Test {
|
|||||||
PeerConnectionInterface::IceServer ice_server;
|
PeerConnectionInterface::IceServer ice_server;
|
||||||
ice_server.uri = "stun:1.1.1.1:3478";
|
ice_server.uri = "stun:1.1.1.1:3478";
|
||||||
config.servers.push_back(ice_server);
|
config.servers.push_back(ice_server);
|
||||||
EXPECT_TRUE(caller_->CreatePc(nullptr, config,
|
EXPECT_TRUE(caller_->CreatePc(config, CreateBuiltinAudioEncoderFactory(),
|
||||||
CreateBuiltinAudioEncoderFactory(),
|
|
||||||
CreateBuiltinAudioDecoderFactory()));
|
CreateBuiltinAudioDecoderFactory()));
|
||||||
EXPECT_TRUE(callee_->CreatePc(nullptr, config,
|
EXPECT_TRUE(callee_->CreatePc(config, CreateBuiltinAudioEncoderFactory(),
|
||||||
CreateBuiltinAudioEncoderFactory(),
|
|
||||||
CreateBuiltinAudioDecoderFactory()));
|
CreateBuiltinAudioDecoderFactory()));
|
||||||
PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
|
PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
|
||||||
|
|
||||||
@ -129,7 +127,7 @@ class RTCStatsIntegrationTest : public testing::Test {
|
|||||||
callee_->CreateDataChannel("data", init);
|
callee_->CreateDataChannel("data", init);
|
||||||
|
|
||||||
// Negotiate and wait for call to establish
|
// Negotiate and wait for call to establish
|
||||||
caller_->CreateOffer(nullptr);
|
caller_->CreateOffer(PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
caller_->WaitForCallEstablished();
|
caller_->WaitForCallEstablished();
|
||||||
callee_->WaitForCallEstablished();
|
callee_->WaitForCallEstablished();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,18 +139,12 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) override {}
|
|
||||||
|
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override {}
|
const RTCOfferAnswerOptions& options) override {}
|
||||||
|
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const RTCOfferAnswerOptions& options) override {}
|
const RTCOfferAnswerOptions& options) override {}
|
||||||
|
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
|
||||||
const MediaConstraintsInterface* constraints) override {}
|
|
||||||
|
|
||||||
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
||||||
SessionDescriptionInterface* desc) override {}
|
SessionDescriptionInterface* desc) override {}
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,6 @@ PeerConnectionTestWrapper::PeerConnectionTestWrapper(
|
|||||||
PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {}
|
PeerConnectionTestWrapper::~PeerConnectionTestWrapper() {}
|
||||||
|
|
||||||
bool PeerConnectionTestWrapper::CreatePc(
|
bool PeerConnectionTestWrapper::CreatePc(
|
||||||
const MediaConstraintsInterface* constraints,
|
|
||||||
const webrtc::PeerConnectionInterface::RTCConfiguration& config,
|
const webrtc::PeerConnectionInterface::RTCConfiguration& config,
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
|
||||||
@ -95,8 +94,7 @@ bool PeerConnectionTestWrapper::CreatePc(
|
|||||||
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator(
|
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator(
|
||||||
new FakeRTCCertificateGenerator());
|
new FakeRTCCertificateGenerator());
|
||||||
peer_connection_ = peer_connection_factory_->CreatePeerConnection(
|
peer_connection_ = peer_connection_factory_->CreatePeerConnection(
|
||||||
config, constraints, std::move(port_allocator), std::move(cert_generator),
|
config, std::move(port_allocator), std::move(cert_generator), this);
|
||||||
this);
|
|
||||||
|
|
||||||
return peer_connection_.get() != NULL;
|
return peer_connection_.get() != NULL;
|
||||||
}
|
}
|
||||||
@ -153,21 +151,21 @@ void PeerConnectionTestWrapper::OnSuccess(SessionDescriptionInterface* desc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnectionTestWrapper::CreateOffer(
|
void PeerConnectionTestWrapper::CreateOffer(
|
||||||
const MediaConstraintsInterface* constraints) {
|
const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
||||||
RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": CreateOffer.";
|
RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_ << ": CreateOffer.";
|
||||||
peer_connection_->CreateOffer(this, constraints);
|
peer_connection_->CreateOffer(this, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnectionTestWrapper::CreateAnswer(
|
void PeerConnectionTestWrapper::CreateAnswer(
|
||||||
const MediaConstraintsInterface* constraints) {
|
const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
||||||
RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
|
RTC_LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
|
||||||
<< ": CreateAnswer.";
|
<< ": CreateAnswer.";
|
||||||
peer_connection_->CreateAnswer(this, constraints);
|
peer_connection_->CreateAnswer(this, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) {
|
void PeerConnectionTestWrapper::ReceiveOfferSdp(const std::string& sdp) {
|
||||||
SetRemoteDescription(SdpType::kOffer, sdp);
|
SetRemoteDescription(SdpType::kOffer, sdp);
|
||||||
CreateAnswer(NULL);
|
CreateAnswer(webrtc::PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) {
|
void PeerConnectionTestWrapper::ReceiveAnswerSdp(const std::string& sdp) {
|
||||||
|
|||||||
@ -35,7 +35,6 @@ class PeerConnectionTestWrapper
|
|||||||
virtual ~PeerConnectionTestWrapper();
|
virtual ~PeerConnectionTestWrapper();
|
||||||
|
|
||||||
bool CreatePc(
|
bool CreatePc(
|
||||||
const webrtc::MediaConstraintsInterface* constraints,
|
|
||||||
const webrtc::PeerConnectionInterface::RTCConfiguration& config,
|
const webrtc::PeerConnectionInterface::RTCConfiguration& config,
|
||||||
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
|
||||||
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory);
|
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory);
|
||||||
@ -66,8 +65,10 @@ class PeerConnectionTestWrapper
|
|||||||
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
|
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
|
||||||
void OnFailure(webrtc::RTCError) override {}
|
void OnFailure(webrtc::RTCError) override {}
|
||||||
|
|
||||||
void CreateOffer(const webrtc::MediaConstraintsInterface* constraints);
|
void CreateOffer(
|
||||||
void CreateAnswer(const webrtc::MediaConstraintsInterface* constraints);
|
const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options);
|
||||||
|
void CreateAnswer(
|
||||||
|
const webrtc::PeerConnectionInterface::RTCOfferAnswerOptions& options);
|
||||||
void ReceiveOfferSdp(const std::string& sdp);
|
void ReceiveOfferSdp(const std::string& sdp);
|
||||||
void ReceiveAnswerSdp(const std::string& sdp);
|
void ReceiveAnswerSdp(const std::string& sdp);
|
||||||
void AddIceCandidate(const std::string& sdp_mid,
|
void AddIceCandidate(const std::string& sdp_mid,
|
||||||
|
|||||||
@ -451,7 +451,9 @@ static void JNI_PeerConnection_CreateOffer(
|
|||||||
rtc::scoped_refptr<CreateSdpObserverJni> observer(
|
rtc::scoped_refptr<CreateSdpObserverJni> observer(
|
||||||
new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
|
new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
|
||||||
std::move(constraints)));
|
std::move(constraints)));
|
||||||
ExtractNativePC(jni, j_pc)->CreateOffer(observer, observer->constraints());
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
|
CopyConstraintsIntoOfferAnswerOptions(observer->constraints(), &options);
|
||||||
|
ExtractNativePC(jni, j_pc)->CreateOffer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void JNI_PeerConnection_CreateAnswer(
|
static void JNI_PeerConnection_CreateAnswer(
|
||||||
@ -464,7 +466,9 @@ static void JNI_PeerConnection_CreateAnswer(
|
|||||||
rtc::scoped_refptr<CreateSdpObserverJni> observer(
|
rtc::scoped_refptr<CreateSdpObserverJni> observer(
|
||||||
new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
|
new rtc::RefCountedObject<CreateSdpObserverJni>(jni, j_observer,
|
||||||
std::move(constraints)));
|
std::move(constraints)));
|
||||||
ExtractNativePC(jni, j_pc)->CreateAnswer(observer, observer->constraints());
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
|
CopyConstraintsIntoOfferAnswerOptions(observer->constraints(), &options);
|
||||||
|
ExtractNativePC(jni, j_pc)->CreateAnswer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void JNI_PeerConnection_SetLocalDescription(
|
static void JNI_PeerConnection_SetLocalDescription(
|
||||||
|
|||||||
@ -448,7 +448,10 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
|||||||
rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
|
rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
|
||||||
observer(new rtc::RefCountedObject
|
observer(new rtc::RefCountedObject
|
||||||
<webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
|
<webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
|
||||||
_peerConnection->CreateOffer(observer, constraints.nativeConstraints.get());
|
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
|
CopyConstraintsIntoOfferAnswerOptions(constraints.nativeConstraints.get(), &options);
|
||||||
|
|
||||||
|
_peerConnection->CreateOffer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)answerForConstraints:(RTCMediaConstraints *)constraints
|
- (void)answerForConstraints:(RTCMediaConstraints *)constraints
|
||||||
@ -458,7 +461,10 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
|||||||
rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
|
rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserverAdapter>
|
||||||
observer(new rtc::RefCountedObject
|
observer(new rtc::RefCountedObject
|
||||||
<webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
|
<webrtc::CreateSessionDescriptionObserverAdapter>(completionHandler));
|
||||||
_peerConnection->CreateAnswer(observer, constraints.nativeConstraints.get());
|
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
|
CopyConstraintsIntoOfferAnswerOptions(constraints.nativeConstraints.get(), &options);
|
||||||
|
|
||||||
|
_peerConnection->CreateAnswer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLocalDescription:(RTCSessionDescription *)sdp
|
- (void)setLocalDescription:(RTCSessionDescription *)sdp
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user