Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: talk/app/webrtc/webrtcsessiondescriptionfactory.cc

Issue 1403633005: Revert of Moving MediaStreamSignaling logic into PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/webrtcsessiondescriptionfactory.h ('k') | talk/libjingle_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/webrtcsessiondescriptionfactory.cc
diff --git a/talk/app/webrtc/webrtcsessiondescriptionfactory.cc b/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
index d391020cd17cd54bea98322abfb5b1f8a535c2b3..876931539a96e22e5b1a2bfa5803d0fe81c3dd7f 100644
--- a/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
+++ b/talk/app/webrtc/webrtcsessiondescriptionfactory.cc
@@ -31,6 +31,7 @@
#include "talk/app/webrtc/jsep.h"
#include "talk/app/webrtc/jsepsessiondescription.h"
#include "talk/app/webrtc/mediaconstraintsinterface.h"
+#include "talk/app/webrtc/mediastreamsignaling.h"
#include "talk/app/webrtc/webrtcsession.h"
#include "webrtc/base/sslidentity.h"
@@ -130,13 +131,16 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
+ MediaStreamSignaling* mediastream_signaling,
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
const rtc::scoped_refptr<WebRtcIdentityRequestObserver>&
identity_request_observer,
WebRtcSession* session,
const std::string& session_id,
+ cricket::DataChannelType dct,
bool dtls_enabled)
: signaling_thread_(signaling_thread),
+ mediastream_signaling_(mediastream_signaling),
session_desc_factory_(channel_manager, &transport_desc_factory_),
// RFC 4566 suggested a Network Time Protocol (NTP) format timestamp
// as the session id and session version. To simplify, it should be fine
@@ -147,6 +151,7 @@
identity_request_observer_(identity_request_observer),
session_(session),
session_id_(session_id),
+ data_channel_type_(dct),
certificate_request_state_(CERTIFICATE_NOT_NEEDED) {
session_desc_factory_.set_add_legacy_streams(false);
// SRTP-SDES is disabled if DTLS is on.
@@ -156,14 +161,18 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
+ MediaStreamSignaling* mediastream_signaling,
WebRtcSession* session,
- const std::string& session_id)
+ const std::string& session_id,
+ cricket::DataChannelType dct)
: WebRtcSessionDescriptionFactory(signaling_thread,
channel_manager,
+ mediastream_signaling,
nullptr,
nullptr,
session,
session_id,
+ dct,
false) {
LOG(LS_VERBOSE) << "DTLS-SRTP disabled.";
}
@@ -171,17 +180,21 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
+ MediaStreamSignaling* mediastream_signaling,
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
WebRtcSession* session,
- const std::string& session_id)
+ const std::string& session_id,
+ cricket::DataChannelType dct)
: WebRtcSessionDescriptionFactory(
- signaling_thread,
- channel_manager,
- dtls_identity_store.Pass(),
- new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(),
- session,
- session_id,
- true) {
+ signaling_thread,
+ channel_manager,
+ mediastream_signaling,
+ dtls_identity_store.Pass(),
+ new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(),
+ session,
+ session_id,
+ dct,
+ true) {
RTC_DCHECK(dtls_identity_store_);
certificate_request_state_ = CERTIFICATE_WAITING;
@@ -203,16 +216,14 @@
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
+ MediaStreamSignaling* mediastream_signaling,
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate,
WebRtcSession* session,
- const std::string& session_id)
- : WebRtcSessionDescriptionFactory(signaling_thread,
- channel_manager,
- nullptr,
- nullptr,
- session,
- session_id,
- true) {
+ const std::string& session_id,
+ cricket::DataChannelType dct)
+ : WebRtcSessionDescriptionFactory(
+ signaling_thread, channel_manager, mediastream_signaling, nullptr,
+ nullptr, session, session_id, dct, true) {
RTC_DCHECK(certificate);
certificate_request_state_ = CERTIFICATE_WAITING;
@@ -253,8 +264,9 @@
void WebRtcSessionDescriptionFactory::CreateOffer(
CreateSessionDescriptionObserver* observer,
- const PeerConnectionInterface::RTCOfferAnswerOptions& options,
- const cricket::MediaSessionOptions& session_options) {
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
+ cricket::MediaSessionOptions session_options;
+
std::string error = "CreateOffer";
if (certificate_request_state_ == CERTIFICATE_FAILED) {
error += kFailedDueToIdentityFailed;
@@ -263,11 +275,24 @@
return;
}
+ if (!mediastream_signaling_->GetOptionsForOffer(options,
+ &session_options)) {
+ error += " called with invalid options.";
+ LOG(LS_ERROR) << error;
+ PostCreateSessionDescriptionFailed(observer, error);
+ return;
+ }
+
if (!ValidStreams(session_options.streams)) {
error += " called with invalid media streams.";
LOG(LS_ERROR) << error;
PostCreateSessionDescriptionFailed(observer, error);
return;
+ }
+
+ if (data_channel_type_ == cricket::DCT_SCTP &&
+ mediastream_signaling_->HasDataChannels()) {
+ session_options.data_channel_type = cricket::DCT_SCTP;
}
CreateSessionDescriptionRequest request(
@@ -283,8 +308,7 @@
void WebRtcSessionDescriptionFactory::CreateAnswer(
CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints,
- const cricket::MediaSessionOptions& session_options) {
+ const MediaConstraintsInterface* constraints) {
std::string error = "CreateAnswer";
if (certificate_request_state_ == CERTIFICATE_FAILED) {
error += kFailedDueToIdentityFailed;
@@ -306,15 +330,28 @@
return;
}
- if (!ValidStreams(session_options.streams)) {
+ cricket::MediaSessionOptions options;
+ if (!mediastream_signaling_->GetOptionsForAnswer(constraints, &options)) {
+ error += " called with invalid constraints.";
+ LOG(LS_ERROR) << error;
+ PostCreateSessionDescriptionFailed(observer, error);
+ return;
+ }
+ if (!ValidStreams(options.streams)) {
error += " called with invalid media streams.";
LOG(LS_ERROR) << error;
PostCreateSessionDescriptionFailed(observer, error);
return;
}
+ // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams
+ // are not signaled in the SDP so does not go through that path and must be
+ // handled here.
+ if (data_channel_type_ == cricket::DCT_SCTP) {
+ options.data_channel_type = cricket::DCT_SCTP;
+ }
CreateSessionDescriptionRequest request(
- CreateSessionDescriptionRequest::kAnswer, observer, session_options);
+ CreateSessionDescriptionRequest::kAnswer, observer, options);
if (certificate_request_state_ == CERTIFICATE_WAITING) {
create_session_description_requests_.push(request);
} else {
« no previous file with comments | « talk/app/webrtc/webrtcsessiondescriptionfactory.h ('k') | talk/libjingle_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698