Adds the support of RTCOfferOptions for PeerConnectionInterface::CreateOffer.
Constraints are still supported for CreateOffer, but converted to RTCOfferOptions internally. BUG=3282 R=pthatcher@webrtc.org Review URL: https://webrtc-codereview.appspot.com/20029004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6822 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b01ce14b13
commit
b18bf5e47d
@ -127,6 +127,12 @@ static bool MediaContentDirectionHasSend(cricket::MediaContentDirection dir) {
|
|||||||
return dir == cricket::MD_SENDONLY || dir == cricket::MD_SENDRECV;
|
return dir == cricket::MD_SENDONLY || dir == cricket::MD_SENDRECV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsValidOfferToReceiveMedia(int value) {
|
||||||
|
typedef PeerConnectionInterface::RTCOfferAnswerOptions Options;
|
||||||
|
return (value >= Options::kUndefined) &&
|
||||||
|
(value <= Options::kMaxOfferToReceiveMedia);
|
||||||
|
}
|
||||||
|
|
||||||
// Factory class for creating remote MediaStreams and MediaStreamTracks.
|
// Factory class for creating remote MediaStreams and MediaStreamTracks.
|
||||||
class RemoteMediaStreamFactory {
|
class RemoteMediaStreamFactory {
|
||||||
public:
|
public:
|
||||||
@ -363,14 +369,32 @@ void MediaStreamSignaling::RemoveLocalStream(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MediaStreamSignaling::GetOptionsForOffer(
|
bool MediaStreamSignaling::GetOptionsForOffer(
|
||||||
const MediaConstraintsInterface* constraints,
|
const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
|
||||||
cricket::MediaSessionOptions* options) {
|
cricket::MediaSessionOptions* session_options) {
|
||||||
UpdateSessionOptions();
|
typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
|
||||||
if (!ParseConstraints(constraints, &options_, false)) {
|
if (!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_audio) ||
|
||||||
|
!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_video)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateSessionOptions();
|
||||||
|
|
||||||
|
// |options.has_audio| and |options.has_video| can only change from false to
|
||||||
|
// true, but never change from true to false. This is to make sure
|
||||||
|
// CreateOffer / CreateAnswer doesn't remove a media content
|
||||||
|
// description that has been created.
|
||||||
|
if (rtc_options.offer_to_receive_audio > 0) {
|
||||||
|
options_.has_audio = true;
|
||||||
|
}
|
||||||
|
if (rtc_options.offer_to_receive_video > 0) {
|
||||||
|
options_.has_video = true;
|
||||||
|
}
|
||||||
|
options_.vad_enabled = rtc_options.voice_activity_detection;
|
||||||
|
options_.transport_options.ice_restart = rtc_options.ice_restart;
|
||||||
|
options_.bundle_enabled = rtc_options.use_rtp_mux;
|
||||||
|
|
||||||
options_.bundle_enabled = EvaluateNeedForBundle(options_);
|
options_.bundle_enabled = EvaluateNeedForBundle(options_);
|
||||||
*options = options_;
|
*session_options = options_;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,11 +200,11 @@ class MediaStreamSignaling : public sigslot::has_slots<> {
|
|||||||
const rtc::Buffer& payload);
|
const rtc::Buffer& payload);
|
||||||
void RemoveSctpDataChannel(int sid);
|
void RemoveSctpDataChannel(int sid);
|
||||||
|
|
||||||
// Returns a MediaSessionOptions struct with options decided by |constraints|,
|
// Returns a MediaSessionOptions struct with options decided by |options|,
|
||||||
// the local MediaStreams and DataChannels.
|
// the local MediaStreams and DataChannels.
|
||||||
virtual bool GetOptionsForOffer(
|
virtual bool GetOptionsForOffer(
|
||||||
const MediaConstraintsInterface* constraints,
|
const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
|
||||||
cricket::MediaSessionOptions* options);
|
cricket::MediaSessionOptions* session_options);
|
||||||
|
|
||||||
// Returns a MediaSessionOptions struct with options decided by
|
// Returns a MediaSessionOptions struct with options decided by
|
||||||
// |constraints|, the local MediaStreams and DataChannels.
|
// |constraints|, the local MediaStreams and DataChannels.
|
||||||
|
@ -62,11 +62,14 @@ using webrtc::IceCandidateInterface;
|
|||||||
using webrtc::MediaConstraintsInterface;
|
using webrtc::MediaConstraintsInterface;
|
||||||
using webrtc::MediaStreamInterface;
|
using webrtc::MediaStreamInterface;
|
||||||
using webrtc::MediaStreamTrackInterface;
|
using webrtc::MediaStreamTrackInterface;
|
||||||
|
using webrtc::PeerConnectionInterface;
|
||||||
using webrtc::SdpParseError;
|
using webrtc::SdpParseError;
|
||||||
using webrtc::SessionDescriptionInterface;
|
using webrtc::SessionDescriptionInterface;
|
||||||
using webrtc::StreamCollection;
|
using webrtc::StreamCollection;
|
||||||
using webrtc::StreamCollectionInterface;
|
using webrtc::StreamCollectionInterface;
|
||||||
|
|
||||||
|
typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
|
||||||
|
|
||||||
// Reference SDP with a MediaStream with label "stream1" and audio track with
|
// Reference SDP with a MediaStream with label "stream1" and audio track with
|
||||||
// id "audio_1" and a video track with id "video_1;
|
// id "audio_1" and a video track with id "video_1;
|
||||||
static const char kSdpStringWithStream1[] =
|
static const char kSdpStringWithStream1[] =
|
||||||
@ -588,115 +591,137 @@ class MediaStreamSignalingTest: public testing::Test {
|
|||||||
rtc::scoped_ptr<FakeDataChannelProvider> data_channel_provider_;
|
rtc::scoped_ptr<FakeDataChannelProvider> data_channel_provider_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TEST_F(MediaStreamSignalingTest, GetOptionsForOfferWithInvalidAudioOption) {
|
||||||
|
RTCOfferAnswerOptions rtc_options;
|
||||||
|
rtc_options.offer_to_receive_audio = RTCOfferAnswerOptions::kUndefined - 1;
|
||||||
|
|
||||||
|
cricket::MediaSessionOptions options;
|
||||||
|
EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
|
|
||||||
|
rtc_options.offer_to_receive_audio =
|
||||||
|
RTCOfferAnswerOptions::kMaxOfferToReceiveMedia + 1;
|
||||||
|
EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(MediaStreamSignalingTest, GetOptionsForOfferWithInvalidVideoOption) {
|
||||||
|
RTCOfferAnswerOptions rtc_options;
|
||||||
|
rtc_options.offer_to_receive_video =
|
||||||
|
RTCOfferAnswerOptions::kUndefined - 1;
|
||||||
|
|
||||||
|
cricket::MediaSessionOptions options;
|
||||||
|
EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
|
|
||||||
|
rtc_options.offer_to_receive_video =
|
||||||
|
RTCOfferAnswerOptions::kMaxOfferToReceiveMedia + 1;
|
||||||
|
EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
|
}
|
||||||
|
|
||||||
// Test that a MediaSessionOptions is created for an offer if
|
// Test that a MediaSessionOptions is created for an offer if
|
||||||
// kOfferToReceiveAudio and kOfferToReceiveVideo constraints are set but no
|
// OfferToReceiveAudio and OfferToReceiveVideo options are set but no
|
||||||
// MediaStreams are sent.
|
// MediaStreams are sent.
|
||||||
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudioVideo) {
|
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudioVideo) {
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions rtc_options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
rtc_options.offer_to_receive_audio = 1;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
rtc_options.offer_to_receive_video = 1;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_TRUE(options.has_audio);
|
EXPECT_TRUE(options.has_audio);
|
||||||
EXPECT_TRUE(options.has_video);
|
EXPECT_TRUE(options.has_video);
|
||||||
EXPECT_TRUE(options.bundle_enabled);
|
EXPECT_TRUE(options.bundle_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions is created for an offer if
|
// Test that a correct MediaSessionOptions is created for an offer if
|
||||||
// kOfferToReceiveAudio constraints is set but no MediaStreams are sent.
|
// OfferToReceiveAudio is set but no MediaStreams are sent.
|
||||||
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudio) {
|
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudio) {
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions rtc_options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
rtc_options.offer_to_receive_audio = 1;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_TRUE(options.has_audio);
|
EXPECT_TRUE(options.has_audio);
|
||||||
EXPECT_FALSE(options.has_video);
|
EXPECT_FALSE(options.has_video);
|
||||||
EXPECT_TRUE(options.bundle_enabled);
|
EXPECT_TRUE(options.bundle_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions is created for an offer if
|
// Test that a correct MediaSessionOptions is created for an offer if
|
||||||
// no constraints or MediaStreams are sent.
|
// the default OfferOptons is used or MediaStreams are sent.
|
||||||
TEST_F(MediaStreamSignalingTest, GetDefaultMediaSessionOptionsForOffer) {
|
TEST_F(MediaStreamSignalingTest, GetDefaultMediaSessionOptionsForOffer) {
|
||||||
|
RTCOfferAnswerOptions rtc_options;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_TRUE(options.has_audio);
|
EXPECT_FALSE(options.has_audio);
|
||||||
EXPECT_FALSE(options.has_video);
|
EXPECT_FALSE(options.has_video);
|
||||||
EXPECT_TRUE(options.bundle_enabled);
|
EXPECT_FALSE(options.bundle_enabled);
|
||||||
|
EXPECT_TRUE(options.vad_enabled);
|
||||||
|
EXPECT_FALSE(options.transport_options.ice_restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions is created for an offer if
|
// Test that a correct MediaSessionOptions is created for an offer if
|
||||||
// kOfferToReceiveVideo constraints is set but no MediaStreams are sent.
|
// OfferToReceiveVideo is set but no MediaStreams are sent.
|
||||||
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithVideo) {
|
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithVideo) {
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions rtc_options;
|
||||||
constraints.SetMandatoryReceiveAudio(false);
|
rtc_options.offer_to_receive_audio = 0;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
rtc_options.offer_to_receive_video = 1;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_FALSE(options.has_audio);
|
EXPECT_FALSE(options.has_audio);
|
||||||
EXPECT_TRUE(options.has_video);
|
EXPECT_TRUE(options.has_video);
|
||||||
EXPECT_TRUE(options.bundle_enabled);
|
EXPECT_TRUE(options.bundle_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions is created for an offer if
|
// Test that a correct MediaSessionOptions is created for an offer if
|
||||||
// kUseRtpMux constraints is set to false.
|
// UseRtpMux is set to false.
|
||||||
TEST_F(MediaStreamSignalingTest,
|
TEST_F(MediaStreamSignalingTest,
|
||||||
GetMediaSessionOptionsForOfferWithBundleDisabled) {
|
GetMediaSessionOptionsForOfferWithBundleDisabled) {
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions rtc_options;
|
||||||
constraints.SetMandatoryReceiveAudio(true);
|
rtc_options.offer_to_receive_audio = 1;
|
||||||
constraints.SetMandatoryReceiveVideo(true);
|
rtc_options.offer_to_receive_video = 1;
|
||||||
constraints.SetMandatoryUseRtpMux(false);
|
rtc_options.use_rtp_mux = false;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_TRUE(options.has_audio);
|
EXPECT_TRUE(options.has_audio);
|
||||||
EXPECT_TRUE(options.has_video);
|
EXPECT_TRUE(options.has_video);
|
||||||
EXPECT_FALSE(options.bundle_enabled);
|
EXPECT_FALSE(options.bundle_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions is created to restart ice if
|
// Test that a correct MediaSessionOptions is created to restart ice if
|
||||||
// kIceRestart constraints is set. It also tests that subsequent
|
// IceRestart is set. It also tests that subsequent MediaSessionOptions don't
|
||||||
// MediaSessionOptions don't have |transport_options.ice_restart| set.
|
// have |transport_options.ice_restart| set.
|
||||||
TEST_F(MediaStreamSignalingTest,
|
TEST_F(MediaStreamSignalingTest,
|
||||||
GetMediaSessionOptionsForOfferWithIceRestart) {
|
GetMediaSessionOptionsForOfferWithIceRestart) {
|
||||||
FakeConstraints constraints;
|
RTCOfferAnswerOptions rtc_options;
|
||||||
constraints.SetMandatoryIceRestart(true);
|
rtc_options.ice_restart = true;
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_TRUE(options.transport_options.ice_restart);
|
EXPECT_TRUE(options.transport_options.ice_restart);
|
||||||
|
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
|
rtc_options = RTCOfferAnswerOptions();
|
||||||
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
EXPECT_FALSE(options.transport_options.ice_restart);
|
EXPECT_FALSE(options.transport_options.ice_restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that GetMediaSessionOptionsForOffer and GetOptionsForAnswer work as
|
|
||||||
// expected if unknown constraints are used.
|
|
||||||
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsWithBadConstraints) {
|
|
||||||
FakeConstraints mandatory;
|
|
||||||
mandatory.AddMandatory("bad_key", "bad_value");
|
|
||||||
cricket::MediaSessionOptions options;
|
|
||||||
EXPECT_FALSE(signaling_->GetOptionsForOffer(&mandatory, &options));
|
|
||||||
EXPECT_FALSE(signaling_->GetOptionsForAnswer(&mandatory, &options));
|
|
||||||
|
|
||||||
FakeConstraints optional;
|
|
||||||
optional.AddOptional("bad_key", "bad_value");
|
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&optional, &options));
|
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForAnswer(&optional, &options));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test that a correct MediaSessionOptions are created for an offer if
|
// Test that a correct MediaSessionOptions are created for an offer if
|
||||||
// a MediaStream is sent and later updated with a new track.
|
// a MediaStream is sent and later updated with a new track.
|
||||||
// MediaConstraints are not used.
|
// MediaConstraints are not used.
|
||||||
TEST_F(MediaStreamSignalingTest, AddTrackToLocalMediaStream) {
|
TEST_F(MediaStreamSignalingTest, AddTrackToLocalMediaStream) {
|
||||||
|
RTCOfferAnswerOptions rtc_options;
|
||||||
rtc::scoped_refptr<StreamCollection> local_streams(
|
rtc::scoped_refptr<StreamCollection> local_streams(
|
||||||
CreateStreamCollection(1));
|
CreateStreamCollection(1));
|
||||||
MediaStreamInterface* local_stream = local_streams->at(0);
|
MediaStreamInterface* local_stream = local_streams->at(0);
|
||||||
EXPECT_TRUE(signaling_->AddLocalStream(local_stream));
|
EXPECT_TRUE(signaling_->AddLocalStream(local_stream));
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
VerifyMediaOptions(local_streams, options);
|
VerifyMediaOptions(local_streams, options);
|
||||||
|
|
||||||
cricket::MediaSessionOptions updated_options;
|
cricket::MediaSessionOptions updated_options;
|
||||||
local_stream->AddTrack(AudioTrack::Create(kAudioTracks[1], NULL));
|
local_stream->AddTrack(AudioTrack::Create(kAudioTracks[1], NULL));
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
|
||||||
VerifyMediaOptions(local_streams, options);
|
VerifyMediaOptions(local_streams, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,21 +739,20 @@ TEST_F(MediaStreamSignalingTest, MediaConstraintsInAnswer) {
|
|||||||
EXPECT_TRUE(answer_options.has_audio);
|
EXPECT_TRUE(answer_options.has_audio);
|
||||||
EXPECT_TRUE(answer_options.has_video);
|
EXPECT_TRUE(answer_options.has_video);
|
||||||
|
|
||||||
FakeConstraints offer_c;
|
RTCOfferAnswerOptions rtc_offer_optoins;
|
||||||
offer_c.SetMandatoryReceiveAudio(false);
|
|
||||||
offer_c.SetMandatoryReceiveVideo(false);
|
|
||||||
|
|
||||||
cricket::MediaSessionOptions offer_options;
|
cricket::MediaSessionOptions offer_options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&offer_c, &offer_options));
|
EXPECT_TRUE(
|
||||||
|
signaling_->GetOptionsForOffer(rtc_offer_optoins, &offer_options));
|
||||||
EXPECT_FALSE(offer_options.has_audio);
|
EXPECT_FALSE(offer_options.has_audio);
|
||||||
EXPECT_FALSE(offer_options.has_video);
|
EXPECT_FALSE(offer_options.has_video);
|
||||||
|
|
||||||
FakeConstraints updated_offer_c;
|
RTCOfferAnswerOptions updated_rtc_offer_optoins;
|
||||||
updated_offer_c.SetMandatoryReceiveAudio(true);
|
updated_rtc_offer_optoins.offer_to_receive_audio = 1;
|
||||||
updated_offer_c.SetMandatoryReceiveVideo(true);
|
updated_rtc_offer_optoins.offer_to_receive_video = 1;
|
||||||
|
|
||||||
cricket::MediaSessionOptions updated_offer_options;
|
cricket::MediaSessionOptions updated_offer_options;
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(&updated_offer_c,
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(updated_rtc_offer_optoins,
|
||||||
&updated_offer_options));
|
&updated_offer_options));
|
||||||
EXPECT_TRUE(updated_offer_options.has_audio);
|
EXPECT_TRUE(updated_offer_options.has_audio);
|
||||||
EXPECT_TRUE(updated_offer_options.has_video);
|
EXPECT_TRUE(updated_offer_options.has_video);
|
||||||
@ -748,7 +772,8 @@ TEST_F(MediaStreamSignalingTest, MediaConstraintsInAnswer) {
|
|||||||
EXPECT_TRUE(updated_answer_options.has_audio);
|
EXPECT_TRUE(updated_answer_options.has_audio);
|
||||||
EXPECT_TRUE(updated_answer_options.has_video);
|
EXPECT_TRUE(updated_answer_options.has_video);
|
||||||
|
|
||||||
EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL,
|
RTCOfferAnswerOptions default_rtc_options;
|
||||||
|
EXPECT_TRUE(signaling_->GetOptionsForOffer(default_rtc_options,
|
||||||
&updated_offer_options));
|
&updated_offer_options));
|
||||||
EXPECT_TRUE(updated_offer_options.has_audio);
|
EXPECT_TRUE(updated_offer_options.has_audio);
|
||||||
EXPECT_TRUE(updated_offer_options.has_video);
|
EXPECT_TRUE(updated_offer_options.has_video);
|
||||||
|
@ -508,7 +508,62 @@ void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
|
|||||||
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
|
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
session_->CreateOffer(observer, constraints);
|
RTCOfferAnswerOptions options;
|
||||||
|
// Defaults to receiving audio and not receiving video.
|
||||||
|
options.offer_to_receive_audio =
|
||||||
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
options.offer_to_receive_video = 0;
|
||||||
|
|
||||||
|
bool value;
|
||||||
|
size_t mandatory_constraints = 0;
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kOfferToReceiveAudio,
|
||||||
|
&value,
|
||||||
|
&mandatory_constraints)) {
|
||||||
|
options.offer_to_receive_audio =
|
||||||
|
value ? RTCOfferAnswerOptions::kOfferToReceiveMediaTrue : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kOfferToReceiveVideo,
|
||||||
|
&value,
|
||||||
|
&mandatory_constraints)) {
|
||||||
|
options.offer_to_receive_video =
|
||||||
|
value ? RTCOfferAnswerOptions::kOfferToReceiveMediaTrue : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kVoiceActivityDetection,
|
||||||
|
&value,
|
||||||
|
&mandatory_constraints)) {
|
||||||
|
options.voice_activity_detection = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kIceRestart,
|
||||||
|
&value,
|
||||||
|
&mandatory_constraints)) {
|
||||||
|
options.ice_restart = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FindConstraint(constraints,
|
||||||
|
MediaConstraintsInterface::kUseRtpMux,
|
||||||
|
&value,
|
||||||
|
&mandatory_constraints)) {
|
||||||
|
options.use_rtp_mux = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateOffer(observer, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
|
const RTCOfferAnswerOptions& options) {
|
||||||
|
if (!VERIFY(observer != NULL)) {
|
||||||
|
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
session_->CreateOffer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerConnection::CreateAnswer(
|
void PeerConnection::CreateAnswer(
|
||||||
|
@ -92,6 +92,8 @@ class PeerConnection : public PeerConnectionInterface,
|
|||||||
// JSEP01
|
// JSEP01
|
||||||
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints);
|
const MediaConstraintsInterface* constraints);
|
||||||
|
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
|
||||||
|
const RTCOfferAnswerOptions& options);
|
||||||
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints);
|
const MediaConstraintsInterface* constraints);
|
||||||
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
|
||||||
|
@ -192,6 +192,38 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
|||||||
explicit RTCConfiguration(IceTransportsType type) : type(type) {}
|
explicit RTCConfiguration(IceTransportsType type) : type(type) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RTCOfferAnswerOptions {
|
||||||
|
static const int kUndefined = -1;
|
||||||
|
static const int kMaxOfferToReceiveMedia = 1;
|
||||||
|
|
||||||
|
// The default value for constraint offerToReceiveX:true.
|
||||||
|
static const int kOfferToReceiveMediaTrue = 1;
|
||||||
|
|
||||||
|
int offer_to_receive_video;
|
||||||
|
int offer_to_receive_audio;
|
||||||
|
bool voice_activity_detection;
|
||||||
|
bool ice_restart;
|
||||||
|
bool use_rtp_mux;
|
||||||
|
|
||||||
|
RTCOfferAnswerOptions()
|
||||||
|
: offer_to_receive_video(kUndefined),
|
||||||
|
offer_to_receive_audio(kUndefined),
|
||||||
|
voice_activity_detection(true),
|
||||||
|
ice_restart(false),
|
||||||
|
use_rtp_mux(true) {}
|
||||||
|
|
||||||
|
RTCOfferAnswerOptions(int offer_to_receive_video,
|
||||||
|
int offer_to_receive_audio,
|
||||||
|
bool voice_activity_detection,
|
||||||
|
bool ice_restart,
|
||||||
|
bool use_rtp_mux)
|
||||||
|
: offer_to_receive_video(offer_to_receive_video),
|
||||||
|
offer_to_receive_audio(offer_to_receive_audio),
|
||||||
|
voice_activity_detection(voice_activity_detection),
|
||||||
|
ice_restart(ice_restart),
|
||||||
|
use_rtp_mux(use_rtp_mux) {}
|
||||||
|
};
|
||||||
|
|
||||||
// Used by GetStats to decide which stats to include in the stats reports.
|
// Used by GetStats to decide which stats to include in the stats reports.
|
||||||
// |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
|
// |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
|
||||||
// |kStatsOutputLevelDebug| includes both the standard stats and additional
|
// |kStatsOutputLevelDebug| includes both the standard stats and additional
|
||||||
@ -239,7 +271,13 @@ 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) = 0;
|
const MediaConstraintsInterface* constraints) {}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
@ -693,9 +693,10 @@ bool WebRtcSession::GetSslRole(rtc::SSLRole* role) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcSession::CreateOffer(CreateSessionDescriptionObserver* observer,
|
void WebRtcSession::CreateOffer(
|
||||||
const MediaConstraintsInterface* constraints) {
|
CreateSessionDescriptionObserver* observer,
|
||||||
webrtc_session_desc_factory_->CreateOffer(observer, constraints);
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
||||||
|
webrtc_session_desc_factory_->CreateOffer(observer, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebRtcSession::CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void WebRtcSession::CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
|
@ -144,8 +144,9 @@ class WebRtcSession : public cricket::BaseSession,
|
|||||||
// TODO - It may be necessary to supply error code as well.
|
// TODO - It may be necessary to supply error code as well.
|
||||||
sigslot::signal0<> SignalError;
|
sigslot::signal0<> SignalError;
|
||||||
|
|
||||||
void CreateOffer(CreateSessionDescriptionObserver* observer,
|
void CreateOffer(
|
||||||
const MediaConstraintsInterface* constraints);
|
CreateSessionDescriptionObserver* observer,
|
||||||
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options);
|
||||||
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
void CreateAnswer(CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints);
|
const MediaConstraintsInterface* constraints);
|
||||||
// The ownership of |desc| will be transferred after this call.
|
// The ownership of |desc| will be transferred after this call.
|
||||||
|
@ -99,6 +99,8 @@ using webrtc::kSdpWithoutSdesCrypto;
|
|||||||
using webrtc::kSessionError;
|
using webrtc::kSessionError;
|
||||||
using webrtc::kSessionErrorDesc;
|
using webrtc::kSessionErrorDesc;
|
||||||
|
|
||||||
|
typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
|
||||||
|
|
||||||
static const int kClientAddrPort = 0;
|
static const int kClientAddrPort = 0;
|
||||||
static const char kClientAddrHost1[] = "11.11.11.11";
|
static const char kClientAddrHost1[] = "11.11.11.11";
|
||||||
static const char kClientAddrHost2[] = "22.22.22.22";
|
static const char kClientAddrHost2[] = "22.22.22.22";
|
||||||
@ -378,18 +380,26 @@ class WebRtcSessionTest : public testing::Test {
|
|||||||
// Call mediastream_signaling_.UseOptionsWithStreamX() before this function
|
// Call mediastream_signaling_.UseOptionsWithStreamX() before this function
|
||||||
// to decide which streams to create.
|
// to decide which streams to create.
|
||||||
void InitiateCall() {
|
void InitiateCall() {
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew !=
|
EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew !=
|
||||||
observer_.ice_gathering_state_,
|
observer_.ice_gathering_state_,
|
||||||
kIceCandidatesTimeout);
|
kIceCandidatesTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SessionDescriptionInterface* CreateOffer() {
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
|
options.offer_to_receive_audio =
|
||||||
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
|
||||||
|
return CreateOffer(options);
|
||||||
|
}
|
||||||
|
|
||||||
SessionDescriptionInterface* CreateOffer(
|
SessionDescriptionInterface* CreateOffer(
|
||||||
const webrtc::MediaConstraintsInterface* constraints) {
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
||||||
rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
|
rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
|
||||||
observer = new WebRtcSessionCreateSDPObserverForTest();
|
observer = new WebRtcSessionCreateSDPObserverForTest();
|
||||||
session_->CreateOffer(observer, constraints);
|
session_->CreateOffer(observer, options);
|
||||||
EXPECT_TRUE_WAIT(
|
EXPECT_TRUE_WAIT(
|
||||||
observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit,
|
observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit,
|
||||||
2000);
|
2000);
|
||||||
@ -833,9 +843,11 @@ class WebRtcSessionTest : public testing::Test {
|
|||||||
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
|
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
FakeConstraints constraints;
|
|
||||||
constraints.SetMandatoryUseRtpMux(bundle);
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
SessionDescriptionInterface* offer = CreateOffer(&constraints);
|
options.use_rtp_mux = bundle;
|
||||||
|
|
||||||
|
SessionDescriptionInterface* offer = CreateOffer(options);
|
||||||
// SetLocalDescription and SetRemoteDescriptions takes ownership of offer
|
// SetLocalDescription and SetRemoteDescriptions takes ownership of offer
|
||||||
// and answer.
|
// and answer.
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
@ -905,7 +917,7 @@ class WebRtcSessionTest : public testing::Test {
|
|||||||
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
|
AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
|
EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
|
||||||
observer_.ice_gathering_state_);
|
observer_.ice_gathering_state_);
|
||||||
@ -1005,7 +1017,7 @@ class WebRtcSessionTest : public testing::Test {
|
|||||||
webrtc::InternalDataChannelInit dci;
|
webrtc::InternalDataChannelInit dci;
|
||||||
dci.reliable = false;
|
dci.reliable = false;
|
||||||
session_->CreateDataChannel("datachannel", &dci);
|
session_->CreateDataChannel("datachannel", &dci);
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,13 +1033,14 @@ class WebRtcSessionTest : public testing::Test {
|
|||||||
SetRemoteDescriptionWithoutError(offer.release());
|
SetRemoteDescriptionWithoutError(offer.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
const int kNumber = 3;
|
const int kNumber = 3;
|
||||||
rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
|
rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
|
||||||
observers[kNumber];
|
observers[kNumber];
|
||||||
for (int i = 0; i < kNumber; ++i) {
|
for (int i = 0; i < kNumber; ++i) {
|
||||||
observers[i] = new WebRtcSessionCreateSDPObserverForTest();
|
observers[i] = new WebRtcSessionCreateSDPObserverForTest();
|
||||||
if (type == CreateSessionDescriptionRequest::kOffer) {
|
if (type == CreateSessionDescriptionRequest::kOffer) {
|
||||||
session_->CreateOffer(observers[i], NULL);
|
session_->CreateOffer(observers[i], options);
|
||||||
} else {
|
} else {
|
||||||
session_->CreateAnswer(observers[i], NULL);
|
session_->CreateAnswer(observers[i], NULL);
|
||||||
}
|
}
|
||||||
@ -1140,7 +1153,7 @@ TEST_F(WebRtcSessionTest, SetSdpFailedOnInvalidSdp) {
|
|||||||
TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
|
TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
const std::string session_id_orig = offer->session_id();
|
const std::string session_id_orig = offer->session_id();
|
||||||
const std::string session_version_orig = offer->session_version();
|
const std::string session_version_orig = offer->session_version();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
@ -1166,7 +1179,7 @@ TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
|
|||||||
|
|
||||||
// Create new offer without send streams.
|
// Create new offer without send streams.
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
offer = CreateOffer(NULL);
|
offer = CreateOffer();
|
||||||
|
|
||||||
// Verify the session id is the same and the session version is
|
// Verify the session id is the same and the session version is
|
||||||
// increased.
|
// increased.
|
||||||
@ -1195,7 +1208,7 @@ TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
|
TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream2();
|
mediastream_signaling_.SendAudioVideoStream2();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
VerifyCryptoParams(offer->description());
|
VerifyCryptoParams(offer->description());
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
|
|
||||||
@ -1222,7 +1235,7 @@ TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
|
|||||||
EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id);
|
EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id);
|
||||||
|
|
||||||
mediastream_signaling_.SendAudioVideoStream1And2();
|
mediastream_signaling_.SendAudioVideoStream1And2();
|
||||||
offer = CreateOffer(NULL);
|
offer = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
|
|
||||||
// Answer by turning off all send streams.
|
// Answer by turning off all send streams.
|
||||||
@ -1252,12 +1265,12 @@ TEST_F(WebRtcSessionTest, SetLocalSdpFailedOnCreateChannel) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
media_engine_->set_fail_create_channel(true);
|
media_engine_->set_fail_create_channel(true);
|
||||||
|
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
// SetRemoteDescription and SetLocalDescription will take the ownership of
|
// SetRemoteDescription and SetLocalDescription will take the ownership of
|
||||||
// the offer.
|
// the offer.
|
||||||
SetRemoteDescriptionOfferExpectError(kCreateChannelFailed, offer);
|
SetRemoteDescriptionOfferExpectError(kCreateChannelFailed, offer);
|
||||||
offer = CreateOffer(NULL);
|
offer = CreateOffer();
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
SetLocalDescriptionOfferExpectError(kCreateChannelFailed, offer);
|
SetLocalDescriptionOfferExpectError(kCreateChannelFailed, offer);
|
||||||
}
|
}
|
||||||
@ -1374,7 +1387,7 @@ TEST_F(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) {
|
|||||||
SetFactoryDtlsSrtp();
|
SetFactoryDtlsSrtp();
|
||||||
|
|
||||||
// Verify that we get a crypto fingerprint in the answer.
|
// Verify that we get a crypto fingerprint in the answer.
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
VerifyFingerprintStatus(offer->description(), true);
|
VerifyFingerprintStatus(offer->description(), true);
|
||||||
// Check that we don't have an a=crypto line in the offer.
|
// Check that we don't have an a=crypto line in the offer.
|
||||||
@ -1440,7 +1453,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
|
TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
|
||||||
MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
||||||
InitWithDtls();
|
InitWithDtls();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
options.has_video = true;
|
options.has_video = true;
|
||||||
JsepSessionDescription* answer =
|
JsepSessionDescription* answer =
|
||||||
@ -1461,7 +1474,7 @@ TEST_F(WebRtcSessionTest, TestCreateOfferReceiveAnswerWithoutEncryption) {
|
|||||||
InitWithDtls();
|
InitWithDtls();
|
||||||
|
|
||||||
// Verify that we get a crypto fingerprint in the answer.
|
// Verify that we get a crypto fingerprint in the answer.
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
VerifyFingerprintStatus(offer->description(), false);
|
VerifyFingerprintStatus(offer->description(), false);
|
||||||
// Check that we don't have an a=crypto line in the offer.
|
// Check that we don't have an a=crypto line in the offer.
|
||||||
@ -1514,11 +1527,11 @@ TEST_F(WebRtcSessionTest, TestSetLocalOfferTwice) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
// SetLocalDescription take ownership of offer.
|
// SetLocalDescription take ownership of offer.
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
// SetLocalDescription take ownership of offer.
|
// SetLocalDescription take ownership of offer.
|
||||||
SessionDescriptionInterface* offer2 = CreateOffer(NULL);
|
SessionDescriptionInterface* offer2 = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer2);
|
SetLocalDescriptionWithoutError(offer2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1526,19 +1539,19 @@ TEST_F(WebRtcSessionTest, TestSetRemoteOfferTwice) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
// SetLocalDescription take ownership of offer.
|
// SetLocalDescription take ownership of offer.
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
|
|
||||||
SessionDescriptionInterface* offer2 = CreateOffer(NULL);
|
SessionDescriptionInterface* offer2 = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer2);
|
SetRemoteDescriptionWithoutError(offer2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
|
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
offer = CreateOffer(NULL);
|
offer = CreateOffer();
|
||||||
SetRemoteDescriptionOfferExpectError(
|
SetRemoteDescriptionOfferExpectError(
|
||||||
"Called in wrong state: STATE_SENTINITIATE", offer);
|
"Called in wrong state: STATE_SENTINITIATE", offer);
|
||||||
}
|
}
|
||||||
@ -1546,9 +1559,9 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) {
|
TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
offer = CreateOffer(NULL);
|
offer = CreateOffer();
|
||||||
SetLocalDescriptionOfferExpectError(
|
SetLocalDescriptionOfferExpectError(
|
||||||
"Called in wrong state: STATE_RECEIVEDINITIATE", offer);
|
"Called in wrong state: STATE_RECEIVEDINITIATE", offer);
|
||||||
}
|
}
|
||||||
@ -1579,7 +1592,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalPrAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
|
TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE);
|
SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE);
|
||||||
|
|
||||||
JsepSessionDescription* pranswer =
|
JsepSessionDescription* pranswer =
|
||||||
@ -1606,8 +1619,8 @@ TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
|
TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
SessionDescriptionInterface* answer =
|
SessionDescriptionInterface* answer =
|
||||||
CreateRemoteAnswer(offer.get());
|
CreateRemoteAnswer(offer.get());
|
||||||
SetLocalDescriptionAnswerExpectError("Called in wrong state: STATE_INIT",
|
SetLocalDescriptionAnswerExpectError("Called in wrong state: STATE_INIT",
|
||||||
@ -1617,8 +1630,8 @@ TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
|
TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendNothing();
|
mediastream_signaling_.SendNothing();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
SessionDescriptionInterface* answer =
|
SessionDescriptionInterface* answer =
|
||||||
CreateRemoteAnswer(offer.get());
|
CreateRemoteAnswer(offer.get());
|
||||||
SetRemoteDescriptionAnswerExpectError(
|
SetRemoteDescriptionAnswerExpectError(
|
||||||
@ -1636,7 +1649,7 @@ TEST_F(WebRtcSessionTest, TestAddRemoteCandidate) {
|
|||||||
// Fail since we have not set a offer description.
|
// Fail since we have not set a offer description.
|
||||||
EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1));
|
EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1));
|
||||||
|
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
// Candidate should be allowed to add before remote description.
|
// Candidate should be allowed to add before remote description.
|
||||||
EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1));
|
EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1));
|
||||||
@ -1770,7 +1783,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteSessionDescriptionWithCandidates) {
|
|||||||
JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0,
|
JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0,
|
||||||
candidate1);
|
candidate1);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
|
EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
@ -1805,8 +1818,8 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
|
|||||||
EXPECT_TRUE_WAIT(0u < observer_.mline_1_candidates_.size(),
|
EXPECT_TRUE_WAIT(0u < observer_.mline_1_candidates_.size(),
|
||||||
kIceCandidatesTimeout);
|
kIceCandidatesTimeout);
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> local_offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
|
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
|
||||||
EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
|
EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
|
||||||
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex1) != NULL);
|
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex1) != NULL);
|
||||||
@ -1827,8 +1840,7 @@ TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
|
|||||||
TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
|
TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
|
|
||||||
// CreateOffer creates session description with the content names "audio" and
|
// CreateOffer creates session description with the content names "audio" and
|
||||||
// "video". Goal is to modify these content names and verify transport channel
|
// "video". Goal is to modify these content names and verify transport channel
|
||||||
@ -1871,8 +1883,8 @@ TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
|
|||||||
// the send streams when no constraints have been set.
|
// the send streams when no constraints have been set.
|
||||||
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
|
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
@ -1887,8 +1899,8 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
// Test Audio only offer.
|
// Test Audio only offer.
|
||||||
mediastream_signaling_.UseOptionsAudioOnly();
|
mediastream_signaling_.UseOptionsAudioOnly();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
EXPECT_TRUE(content != NULL);
|
EXPECT_TRUE(content != NULL);
|
||||||
@ -1897,7 +1909,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) {
|
|||||||
|
|
||||||
// Test Audio / Video offer.
|
// Test Audio / Video offer.
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
offer.reset(CreateOffer(NULL));
|
offer.reset(CreateOffer());
|
||||||
content = cricket::GetFirstAudioContent(offer->description());
|
content = cricket::GetFirstAudioContent(offer->description());
|
||||||
EXPECT_TRUE(content != NULL);
|
EXPECT_TRUE(content != NULL);
|
||||||
content = cricket::GetFirstVideoContent(offer->description());
|
content = cricket::GetFirstVideoContent(offer->description());
|
||||||
@ -1908,12 +1920,13 @@ TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraints) {
|
|||||||
// kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false.
|
// kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false.
|
||||||
TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
|
TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
webrtc::FakeConstraints constraints_no_receive;
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
constraints_no_receive.SetMandatoryReceiveAudio(false);
|
options.offer_to_receive_audio = 0;
|
||||||
constraints_no_receive.SetMandatoryReceiveVideo(false);
|
options.offer_to_receive_video = 0;
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
||||||
CreateOffer(&constraints_no_receive));
|
CreateOffer(options));
|
||||||
|
|
||||||
ASSERT_TRUE(offer != NULL);
|
ASSERT_TRUE(offer != NULL);
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
@ -1926,10 +1939,12 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
|
|||||||
// kOfferToReceiveAudio constraints are set to true.
|
// kOfferToReceiveAudio constraints are set to true.
|
||||||
TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
|
TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
webrtc::FakeConstraints constraints_audio_only;
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
constraints_audio_only.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio =
|
||||||
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
||||||
CreateOffer(&constraints_audio_only));
|
CreateOffer(options));
|
||||||
|
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
@ -1943,11 +1958,15 @@ TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
|
|||||||
TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
|
TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
// Test Audio / Video offer.
|
// Test Audio / Video offer.
|
||||||
webrtc::FakeConstraints constraints_audio_video;
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
constraints_audio_video.SetMandatoryReceiveAudio(true);
|
options.offer_to_receive_audio =
|
||||||
constraints_audio_video.SetMandatoryReceiveVideo(true);
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
options.offer_to_receive_video =
|
||||||
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
||||||
CreateOffer(&constraints_audio_video));
|
CreateOffer(options));
|
||||||
|
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
|
|
||||||
@ -1963,7 +1982,7 @@ TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
|
|||||||
// an offer.
|
// an offer.
|
||||||
TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) {
|
TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
||||||
SetRemoteDescriptionWithoutError(answer);
|
SetRemoteDescriptionWithoutError(answer);
|
||||||
@ -2090,10 +2109,14 @@ TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) {
|
|||||||
TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) {
|
TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) {
|
||||||
AddCNCodecs();
|
AddCNCodecs();
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
webrtc::FakeConstraints constraints;
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
constraints.SetOptionalVAD(false);
|
options.offer_to_receive_audio =
|
||||||
|
RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
|
||||||
|
options.voice_activity_detection = false;
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
||||||
CreateOffer(&constraints));
|
CreateOffer(options));
|
||||||
|
|
||||||
const cricket::ContentInfo* content =
|
const cricket::ContentInfo* content =
|
||||||
cricket::GetFirstAudioContent(offer->description());
|
cricket::GetFirstAudioContent(offer->description());
|
||||||
EXPECT_TRUE(content != NULL);
|
EXPECT_TRUE(content != NULL);
|
||||||
@ -2125,7 +2148,7 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithAudioOnlyAnswer) {
|
|||||||
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
|
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
|
||||||
|
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
options.has_video = false;
|
options.has_video = false;
|
||||||
@ -2182,7 +2205,7 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) {
|
|||||||
EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL);
|
EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL);
|
||||||
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
|
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions options;
|
||||||
options.has_audio = false;
|
options.has_audio = false;
|
||||||
@ -2233,8 +2256,7 @@ TEST_F(WebRtcSessionTest, TestAVOfferWithVideoOnlyAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
|
TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
scoped_ptr<SessionDescriptionInterface> offer(
|
scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
VerifyCryptoParams(offer->description());
|
VerifyCryptoParams(offer->description());
|
||||||
SetRemoteDescriptionWithoutError(offer.release());
|
SetRemoteDescriptionWithoutError(offer.release());
|
||||||
scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
|
scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
|
||||||
@ -2245,8 +2267,7 @@ TEST_F(WebRtcSessionTest, VerifyNoCryptoParamsInSDP) {
|
|||||||
options_.disable_encryption = true;
|
options_.disable_encryption = true;
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
scoped_ptr<SessionDescriptionInterface> offer(
|
scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
VerifyNoCryptoParams(offer->description(), false);
|
VerifyNoCryptoParams(offer->description(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2265,7 +2286,8 @@ TEST_F(WebRtcSessionTest, VerifyAnswerFromCryptoOffer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
|
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
|
|
||||||
std::string sdp;
|
std::string sdp;
|
||||||
RemoveIceUfragPwdLines(offer.get(), &sdp);
|
RemoveIceUfragPwdLines(offer.get(), &sdp);
|
||||||
SessionDescriptionInterface* modified_offer =
|
SessionDescriptionInterface* modified_offer =
|
||||||
@ -2291,7 +2313,8 @@ TEST_F(WebRtcSessionTest, TestSetLocalDescriptionInvalidIceCredentials) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
|
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
|
|
||||||
std::string sdp;
|
std::string sdp;
|
||||||
// Modifying ice ufrag and pwd in local offer with strings smaller than the
|
// Modifying ice ufrag and pwd in local offer with strings smaller than the
|
||||||
// recommended values of 4 and 22 bytes respectively.
|
// recommended values of 4 and 22 bytes respectively.
|
||||||
@ -2340,8 +2363,8 @@ TEST_F(WebRtcSessionTest, VerifyBundleFlagInPA) {
|
|||||||
Init(NULL);
|
Init(NULL);
|
||||||
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
||||||
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
cricket::SessionDescription* offer_copy =
|
cricket::SessionDescription* offer_copy =
|
||||||
offer->description()->Copy();
|
offer->description()->Copy();
|
||||||
offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
|
offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
|
||||||
@ -2358,9 +2381,12 @@ TEST_F(WebRtcSessionTest, TestDisabledBundleInAnswer) {
|
|||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
||||||
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
||||||
FakeConstraints constraints;
|
|
||||||
constraints.SetMandatoryUseRtpMux(true);
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
SessionDescriptionInterface* offer = CreateOffer(&constraints);
|
options.use_rtp_mux = true;
|
||||||
|
|
||||||
|
SessionDescriptionInterface* offer = CreateOffer(options);
|
||||||
|
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
mediastream_signaling_.SendAudioVideoStream2();
|
mediastream_signaling_.SendAudioVideoStream2();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
||||||
@ -2396,9 +2422,11 @@ TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) {
|
|||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
|
||||||
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
|
||||||
FakeConstraints constraints;
|
|
||||||
constraints.SetMandatoryUseRtpMux(true);
|
PeerConnectionInterface::RTCOfferAnswerOptions options;
|
||||||
SessionDescriptionInterface* offer = CreateOffer(&constraints);
|
options.use_rtp_mux = true;
|
||||||
|
|
||||||
|
SessionDescriptionInterface* offer = CreateOffer(options);
|
||||||
std::string offer_str;
|
std::string offer_str;
|
||||||
offer->ToString(&offer_str);
|
offer->ToString(&offer_str);
|
||||||
// Disable rtcp-mux
|
// Disable rtcp-mux
|
||||||
@ -2568,7 +2596,7 @@ TEST_F(WebRtcSessionTest, InsertDtmf) {
|
|||||||
TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
|
TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
EXPECT_FALSE(session_->initiator());
|
EXPECT_FALSE(session_->initiator());
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
EXPECT_TRUE(session_->initiator());
|
EXPECT_TRUE(session_->initiator());
|
||||||
@ -2594,7 +2622,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorFlagAsReceiver) {
|
|||||||
TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
|
TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
||||||
CreateRemoteAnswer(offer));
|
CreateRemoteAnswer(offer));
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
@ -2616,7 +2644,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
|
TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
@ -2630,7 +2658,7 @@ TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
|
TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
||||||
CreateAnswer(NULL));
|
CreateAnswer(NULL));
|
||||||
@ -2652,7 +2680,7 @@ TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
|
TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetRemoteDescriptionWithoutError(offer);
|
SetRemoteDescriptionWithoutError(offer);
|
||||||
SessionDescriptionInterface* answer = CreateAnswer(NULL);
|
SessionDescriptionInterface* answer = CreateAnswer(NULL);
|
||||||
SetLocalDescriptionWithoutError(answer);
|
SetLocalDescriptionWithoutError(answer);
|
||||||
@ -2665,8 +2693,8 @@ TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
|
TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
std::string offer_str;
|
std::string offer_str;
|
||||||
offer->ToString(&offer_str);
|
offer->ToString(&offer_str);
|
||||||
// Disable google-ice
|
// Disable google-ice
|
||||||
@ -2697,7 +2725,7 @@ TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
|
|||||||
TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
|
TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
rtc::scoped_ptr<SessionDescriptionInterface> answer(
|
||||||
CreateRemoteAnswer(session_->local_description()));
|
CreateRemoteAnswer(session_->local_description()));
|
||||||
@ -2798,8 +2826,7 @@ TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
|
|||||||
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
|
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
|
|
||||||
// Making sure SetLocalDescription correctly sets crypto value in
|
// Making sure SetLocalDescription correctly sets crypto value in
|
||||||
// SessionDescription object after de-serialization of sdp string. The value
|
// SessionDescription object after de-serialization of sdp string. The value
|
||||||
@ -2818,8 +2845,7 @@ TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescriptionWithDisabled) {
|
|||||||
options_.disable_encryption = true;
|
options_.disable_encryption = true;
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
CreateOffer(NULL));
|
|
||||||
|
|
||||||
// Making sure SetLocalDescription correctly sets crypto value in
|
// Making sure SetLocalDescription correctly sets crypto value in
|
||||||
// SessionDescription object after de-serialization of sdp string. The value
|
// SessionDescription object after de-serialization of sdp string. The value
|
||||||
@ -2900,7 +2926,7 @@ TEST_F(WebRtcSessionTest, TestCreateAnswerWithOldUfragAndPassword) {
|
|||||||
TEST_F(WebRtcSessionTest, TestSessionContentError) {
|
TEST_F(WebRtcSessionTest, TestSessionContentError) {
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
const std::string session_id_orig = offer->session_id();
|
const std::string session_id_orig = offer->session_id();
|
||||||
const std::string session_version_orig = offer->session_version();
|
const std::string session_version_orig = offer->session_version();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
@ -2985,7 +3011,7 @@ TEST_F(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) {
|
|||||||
|
|
||||||
InitWithDtls();
|
InitWithDtls();
|
||||||
|
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL);
|
EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL);
|
||||||
EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL);
|
EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL);
|
||||||
}
|
}
|
||||||
@ -3099,7 +3125,8 @@ TEST_F(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) {
|
|||||||
|
|
||||||
EXPECT_TRUE(session_->waiting_for_identity());
|
EXPECT_TRUE(session_->waiting_for_identity());
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
|
|
||||||
EXPECT_TRUE(offer != NULL);
|
EXPECT_TRUE(offer != NULL);
|
||||||
VerifyNoCryptoParams(offer->description(), true);
|
VerifyNoCryptoParams(offer->description(), true);
|
||||||
VerifyFingerprintStatus(offer->description(), true);
|
VerifyFingerprintStatus(offer->description(), true);
|
||||||
@ -3132,7 +3159,8 @@ TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) {
|
|||||||
InitWithDtls();
|
InitWithDtls();
|
||||||
|
|
||||||
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
|
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
|
||||||
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
EXPECT_TRUE(offer != NULL);
|
EXPECT_TRUE(offer != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3143,7 +3171,8 @@ TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) {
|
|||||||
InitWithDtls(true);
|
InitWithDtls(true);
|
||||||
|
|
||||||
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
|
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
|
||||||
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
|
|
||||||
|
rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
|
||||||
EXPECT_TRUE(offer == NULL);
|
EXPECT_TRUE(offer == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3211,7 +3240,7 @@ TEST_F(WebRtcSessionTest, TestDscpConstraint) {
|
|||||||
webrtc::MediaConstraintsInterface::kEnableDscp, true);
|
webrtc::MediaConstraintsInterface::kEnableDscp, true);
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
@ -3237,7 +3266,7 @@ TEST_F(WebRtcSessionTest, TestSuspendBelowMinBitrateConstraint) {
|
|||||||
true);
|
true);
|
||||||
Init(NULL);
|
Init(NULL);
|
||||||
mediastream_signaling_.SendAudioVideoStream1();
|
mediastream_signaling_.SendAudioVideoStream1();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
|
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
@ -3258,7 +3287,7 @@ TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) {
|
|||||||
SetFactoryDtlsSrtp();
|
SetFactoryDtlsSrtp();
|
||||||
|
|
||||||
mediastream_signaling_.UseOptionsAudioOnly();
|
mediastream_signaling_.UseOptionsAudioOnly();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
||||||
@ -3288,7 +3317,7 @@ TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) {
|
|||||||
SetFactoryDtlsSrtp();
|
SetFactoryDtlsSrtp();
|
||||||
|
|
||||||
mediastream_signaling_.UseOptionsAudioOnly();
|
mediastream_signaling_.UseOptionsAudioOnly();
|
||||||
SessionDescriptionInterface* offer = CreateOffer(NULL);
|
SessionDescriptionInterface* offer = CreateOffer();
|
||||||
SetLocalDescriptionWithoutError(offer);
|
SetLocalDescriptionWithoutError(offer);
|
||||||
|
|
||||||
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
|
||||||
|
@ -166,8 +166,9 @@ WebRtcSessionDescriptionFactory::~WebRtcSessionDescriptionFactory() {
|
|||||||
|
|
||||||
void WebRtcSessionDescriptionFactory::CreateOffer(
|
void WebRtcSessionDescriptionFactory::CreateOffer(
|
||||||
CreateSessionDescriptionObserver* observer,
|
CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints) {
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
|
||||||
cricket::MediaSessionOptions options;
|
cricket::MediaSessionOptions session_options;
|
||||||
|
|
||||||
std::string error = "CreateOffer";
|
std::string error = "CreateOffer";
|
||||||
if (identity_request_state_ == IDENTITY_FAILED) {
|
if (identity_request_state_ == IDENTITY_FAILED) {
|
||||||
error += kFailedDueToIdentityFailed;
|
error += kFailedDueToIdentityFailed;
|
||||||
@ -176,14 +177,15 @@ void WebRtcSessionDescriptionFactory::CreateOffer(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mediastream_signaling_->GetOptionsForOffer(constraints, &options)) {
|
if (!mediastream_signaling_->GetOptionsForOffer(options,
|
||||||
error += " called with invalid constraints.";
|
&session_options)) {
|
||||||
|
error += " called with invalid options.";
|
||||||
LOG(LS_ERROR) << error;
|
LOG(LS_ERROR) << error;
|
||||||
PostCreateSessionDescriptionFailed(observer, error);
|
PostCreateSessionDescriptionFailed(observer, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidStreams(options.streams)) {
|
if (!ValidStreams(session_options.streams)) {
|
||||||
error += " called with invalid media streams.";
|
error += " called with invalid media streams.";
|
||||||
LOG(LS_ERROR) << error;
|
LOG(LS_ERROR) << error;
|
||||||
PostCreateSessionDescriptionFailed(observer, error);
|
PostCreateSessionDescriptionFailed(observer, error);
|
||||||
@ -192,11 +194,11 @@ void WebRtcSessionDescriptionFactory::CreateOffer(
|
|||||||
|
|
||||||
if (data_channel_type_ == cricket::DCT_SCTP &&
|
if (data_channel_type_ == cricket::DCT_SCTP &&
|
||||||
mediastream_signaling_->HasDataChannels()) {
|
mediastream_signaling_->HasDataChannels()) {
|
||||||
options.data_channel_type = cricket::DCT_SCTP;
|
session_options.data_channel_type = cricket::DCT_SCTP;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateSessionDescriptionRequest request(
|
CreateSessionDescriptionRequest request(
|
||||||
CreateSessionDescriptionRequest::kOffer, observer, options);
|
CreateSessionDescriptionRequest::kOffer, observer, session_options);
|
||||||
if (identity_request_state_ == IDENTITY_WAITING) {
|
if (identity_request_state_ == IDENTITY_WAITING) {
|
||||||
create_session_description_requests_.push(request);
|
create_session_description_requests_.push(request);
|
||||||
} else {
|
} else {
|
||||||
|
@ -107,7 +107,7 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
|
|||||||
|
|
||||||
void CreateOffer(
|
void CreateOffer(
|
||||||
CreateSessionDescriptionObserver* observer,
|
CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints);
|
const PeerConnectionInterface::RTCOfferAnswerOptions& options);
|
||||||
void CreateAnswer(
|
void CreateAnswer(
|
||||||
CreateSessionDescriptionObserver* observer,
|
CreateSessionDescriptionObserver* observer,
|
||||||
const MediaConstraintsInterface* constraints);
|
const MediaConstraintsInterface* constraints);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user