OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 dest_desc->AddCandidate(source_candidates->at(n)); | 122 dest_desc->AddCandidate(source_candidates->at(n)); |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( | 127 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( |
128 rtc::Thread* signaling_thread, | 128 rtc::Thread* signaling_thread, |
129 cricket::ChannelManager* channel_manager, | 129 cricket::ChannelManager* channel_manager, |
130 MediaStreamSignaling* mediastream_signaling, | 130 MediaStreamSignaling* mediastream_signaling, |
131 DTLSIdentityServiceInterface* dtls_identity_service, | 131 DTLSIdentityServiceInterface* dtls_identity_service, |
| 132 rtc::KeyType key_type, |
132 WebRtcSession* session, | 133 WebRtcSession* session, |
133 const std::string& session_id, | 134 const std::string& session_id, |
134 cricket::DataChannelType dct, | 135 cricket::DataChannelType dct, |
135 bool dtls_enabled) | 136 bool dtls_enabled) |
136 : signaling_thread_(signaling_thread), | 137 : signaling_thread_(signaling_thread), |
137 mediastream_signaling_(mediastream_signaling), | 138 mediastream_signaling_(mediastream_signaling), |
138 session_desc_factory_(channel_manager, &transport_desc_factory_), | 139 session_desc_factory_(channel_manager, &transport_desc_factory_), |
139 // RFC 4566 suggested a Network Time Protocol (NTP) format timestamp | 140 // RFC 4566 suggested a Network Time Protocol (NTP) format timestamp |
140 // as the session id and session version. To simplify, it should be fine | 141 // as the session id and session version. To simplify, it should be fine |
141 // to just use a random number as session id and start version from | 142 // to just use a random number as session id and start version from |
142 // |kInitSessionVersion|. | 143 // |kInitSessionVersion|. |
143 session_version_(kInitSessionVersion), | 144 session_version_(kInitSessionVersion), |
144 identity_service_(dtls_identity_service), | 145 identity_service_(dtls_identity_service), |
145 session_(session), | 146 session_(session), |
146 session_id_(session_id), | 147 session_id_(session_id), |
147 data_channel_type_(dct), | 148 data_channel_type_(dct), |
148 identity_request_state_(IDENTITY_NOT_NEEDED) { | 149 identity_request_state_(IDENTITY_NOT_NEEDED) { |
149 transport_desc_factory_.set_protocol(cricket::ICEPROTO_RFC5245); | 150 transport_desc_factory_.set_protocol(cricket::ICEPROTO_RFC5245); |
150 session_desc_factory_.set_add_legacy_streams(false); | 151 session_desc_factory_.set_add_legacy_streams(false); |
151 // SRTP-SDES is disabled if DTLS is on. | 152 // SRTP-SDES is disabled if DTLS is on. |
152 SetSdesPolicy(dtls_enabled ? cricket::SEC_DISABLED : cricket::SEC_REQUIRED); | 153 SetSdesPolicy(dtls_enabled ? cricket::SEC_DISABLED : cricket::SEC_REQUIRED); |
153 | 154 |
154 if (!dtls_enabled) { | 155 if (!dtls_enabled) { |
155 return; | 156 return; |
156 } | 157 } |
157 | 158 |
| 159 // TODO(hbos): Use |key_type| after webrtc CR 1176383004 lands. |
158 if (identity_service_.get()) { | 160 if (identity_service_.get()) { |
159 identity_request_observer_ = | 161 identity_request_observer_ = |
160 new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(); | 162 new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(); |
161 | 163 |
162 identity_request_observer_->SignalRequestFailed.connect( | 164 identity_request_observer_->SignalRequestFailed.connect( |
163 this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); | 165 this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); |
164 identity_request_observer_->SignalIdentityReady.connect( | 166 identity_request_observer_->SignalIdentityReady.connect( |
165 this, &WebRtcSessionDescriptionFactory::SetIdentity); | 167 this, &WebRtcSessionDescriptionFactory::SetIdentity); |
166 | 168 |
167 if (identity_service_->RequestIdentity( | 169 if (identity_service_->RequestIdentity( |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 if (create_session_description_requests_.front().type == | 450 if (create_session_description_requests_.front().type == |
449 CreateSessionDescriptionRequest::kOffer) { | 451 CreateSessionDescriptionRequest::kOffer) { |
450 InternalCreateOffer(create_session_description_requests_.front()); | 452 InternalCreateOffer(create_session_description_requests_.front()); |
451 } else { | 453 } else { |
452 InternalCreateAnswer(create_session_description_requests_.front()); | 454 InternalCreateAnswer(create_session_description_requests_.front()); |
453 } | 455 } |
454 create_session_description_requests_.pop(); | 456 create_session_description_requests_.pop(); |
455 } | 457 } |
456 } | 458 } |
457 } // namespace webrtc | 459 } // namespace webrtc |
OLD | NEW |