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

Side by Side Diff: talk/app/webrtc/webrtcsessiondescriptionfactory.h

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 unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 #include "webrtc/base/rtccertificate.h" 36 #include "webrtc/base/rtccertificate.h"
37 37
38 namespace cricket { 38 namespace cricket {
39 class ChannelManager; 39 class ChannelManager;
40 class TransportDescriptionFactory; 40 class TransportDescriptionFactory;
41 } // namespace cricket 41 } // namespace cricket
42 42
43 namespace webrtc { 43 namespace webrtc {
44 class CreateSessionDescriptionObserver; 44 class CreateSessionDescriptionObserver;
45 class MediaConstraintsInterface; 45 class MediaConstraintsInterface;
46 class MediaStreamSignaling;
46 class SessionDescriptionInterface; 47 class SessionDescriptionInterface;
47 class WebRtcSession; 48 class WebRtcSession;
48 49
49 // DTLS identity request callback class. 50 // DTLS identity request callback class.
50 class WebRtcIdentityRequestObserver : public DtlsIdentityRequestObserver, 51 class WebRtcIdentityRequestObserver : public DtlsIdentityRequestObserver,
51 public sigslot::has_slots<> { 52 public sigslot::has_slots<> {
52 public: 53 public:
53 // DtlsIdentityRequestObserver overrides. 54 // DtlsIdentityRequestObserver overrides.
54 void OnFailure(int error) override; 55 void OnFailure(int error) override;
55 void OnSuccess(const std::string& der_cert, 56 void OnSuccess(const std::string& der_cert,
(...skipping 28 matching lines...) Expand all
84 // the async DTLS identity generation for WebRtcSession. 85 // the async DTLS identity generation for WebRtcSession.
85 // It queues the create offer/answer request until the DTLS identity 86 // It queues the create offer/answer request until the DTLS identity
86 // request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady 87 // request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady
87 // is called. 88 // is called.
88 class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, 89 class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
89 public sigslot::has_slots<> { 90 public sigslot::has_slots<> {
90 public: 91 public:
91 // Construct with DTLS disabled. 92 // Construct with DTLS disabled.
92 WebRtcSessionDescriptionFactory(rtc::Thread* signaling_thread, 93 WebRtcSessionDescriptionFactory(rtc::Thread* signaling_thread,
93 cricket::ChannelManager* channel_manager, 94 cricket::ChannelManager* channel_manager,
95 MediaStreamSignaling* mediastream_signaling,
94 WebRtcSession* session, 96 WebRtcSession* session,
95 const std::string& session_id); 97 const std::string& session_id,
98 cricket::DataChannelType dct);
96 99
97 // Construct with DTLS enabled using the specified |dtls_identity_store| to 100 // Construct with DTLS enabled using the specified |dtls_identity_store| to
98 // generate a certificate. 101 // generate a certificate.
99 WebRtcSessionDescriptionFactory( 102 WebRtcSessionDescriptionFactory(
100 rtc::Thread* signaling_thread, 103 rtc::Thread* signaling_thread,
101 cricket::ChannelManager* channel_manager, 104 cricket::ChannelManager* channel_manager,
105 MediaStreamSignaling* mediastream_signaling,
102 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 106 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
103 WebRtcSession* session, 107 WebRtcSession* session,
104 const std::string& session_id); 108 const std::string& session_id,
109 cricket::DataChannelType dct);
105 110
106 // Construct with DTLS enabled using the specified (already generated) 111 // Construct with DTLS enabled using the specified (already generated)
107 // |certificate|. 112 // |certificate|.
108 WebRtcSessionDescriptionFactory( 113 WebRtcSessionDescriptionFactory(
109 rtc::Thread* signaling_thread, 114 rtc::Thread* signaling_thread,
110 cricket::ChannelManager* channel_manager, 115 cricket::ChannelManager* channel_manager,
116 MediaStreamSignaling* mediastream_signaling,
111 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate, 117 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate,
112 WebRtcSession* session, 118 WebRtcSession* session,
113 const std::string& session_id); 119 const std::string& session_id,
120 cricket::DataChannelType dct);
114 virtual ~WebRtcSessionDescriptionFactory(); 121 virtual ~WebRtcSessionDescriptionFactory();
115 122
116 static void CopyCandidatesFromSessionDescription( 123 static void CopyCandidatesFromSessionDescription(
117 const SessionDescriptionInterface* source_desc, 124 const SessionDescriptionInterface* source_desc,
118 SessionDescriptionInterface* dest_desc); 125 SessionDescriptionInterface* dest_desc);
119 126
120 void CreateOffer( 127 void CreateOffer(
121 CreateSessionDescriptionObserver* observer, 128 CreateSessionDescriptionObserver* observer,
122 const PeerConnectionInterface::RTCOfferAnswerOptions& options, 129 const PeerConnectionInterface::RTCOfferAnswerOptions& options);
123 const cricket::MediaSessionOptions& session_options); 130 void CreateAnswer(
124 void CreateAnswer(CreateSessionDescriptionObserver* observer, 131 CreateSessionDescriptionObserver* observer,
125 const MediaConstraintsInterface* constraints, 132 const MediaConstraintsInterface* constraints);
126 const cricket::MediaSessionOptions& session_options);
127 133
128 void SetSdesPolicy(cricket::SecurePolicy secure_policy); 134 void SetSdesPolicy(cricket::SecurePolicy secure_policy);
129 cricket::SecurePolicy SdesPolicy() const; 135 cricket::SecurePolicy SdesPolicy() const;
130 136
131 sigslot::signal1<const rtc::scoped_refptr<rtc::RTCCertificate>&> 137 sigslot::signal1<const rtc::scoped_refptr<rtc::RTCCertificate>&>
132 SignalCertificateReady; 138 SignalCertificateReady;
133 139
134 // For testing. 140 // For testing.
135 bool waiting_for_certificate_for_testing() const { 141 bool waiting_for_certificate_for_testing() const {
136 return certificate_request_state_ == CERTIFICATE_WAITING; 142 return certificate_request_state_ == CERTIFICATE_WAITING;
137 } 143 }
138 144
139 private: 145 private:
140 enum CertificateRequestState { 146 enum CertificateRequestState {
141 CERTIFICATE_NOT_NEEDED, 147 CERTIFICATE_NOT_NEEDED,
142 CERTIFICATE_WAITING, 148 CERTIFICATE_WAITING,
143 CERTIFICATE_SUCCEEDED, 149 CERTIFICATE_SUCCEEDED,
144 CERTIFICATE_FAILED, 150 CERTIFICATE_FAILED,
145 }; 151 };
146 152
147 WebRtcSessionDescriptionFactory( 153 WebRtcSessionDescriptionFactory(
148 rtc::Thread* signaling_thread, 154 rtc::Thread* signaling_thread,
149 cricket::ChannelManager* channel_manager, 155 cricket::ChannelManager* channel_manager,
156 MediaStreamSignaling* mediastream_signaling,
150 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 157 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
151 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>& 158 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>&
152 identity_request_observer, 159 identity_request_observer,
153 WebRtcSession* session, 160 WebRtcSession* session,
154 const std::string& session_id, 161 const std::string& session_id,
162 cricket::DataChannelType dct,
155 bool dtls_enabled); 163 bool dtls_enabled);
156 164
157 // MessageHandler implementation. 165 // MessageHandler implementation.
158 virtual void OnMessage(rtc::Message* msg); 166 virtual void OnMessage(rtc::Message* msg);
159 167
160 void InternalCreateOffer(CreateSessionDescriptionRequest request); 168 void InternalCreateOffer(CreateSessionDescriptionRequest request);
161 void InternalCreateAnswer(CreateSessionDescriptionRequest request); 169 void InternalCreateAnswer(CreateSessionDescriptionRequest request);
162 // Posts failure notifications for all pending session description requests. 170 // Posts failure notifications for all pending session description requests.
163 void FailPendingRequests(const std::string& reason); 171 void FailPendingRequests(const std::string& reason);
164 void PostCreateSessionDescriptionFailed( 172 void PostCreateSessionDescriptionFailed(
165 CreateSessionDescriptionObserver* observer, 173 CreateSessionDescriptionObserver* observer,
166 const std::string& error); 174 const std::string& error);
167 void PostCreateSessionDescriptionSucceeded( 175 void PostCreateSessionDescriptionSucceeded(
168 CreateSessionDescriptionObserver* observer, 176 CreateSessionDescriptionObserver* observer,
169 SessionDescriptionInterface* description); 177 SessionDescriptionInterface* description);
170 178
171 void OnIdentityRequestFailed(int error); 179 void OnIdentityRequestFailed(int error);
172 void SetCertificate( 180 void SetCertificate(
173 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); 181 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
174 182
175 std::queue<CreateSessionDescriptionRequest> 183 std::queue<CreateSessionDescriptionRequest>
176 create_session_description_requests_; 184 create_session_description_requests_;
177 rtc::Thread* const signaling_thread_; 185 rtc::Thread* const signaling_thread_;
186 MediaStreamSignaling* const mediastream_signaling_;
178 cricket::TransportDescriptionFactory transport_desc_factory_; 187 cricket::TransportDescriptionFactory transport_desc_factory_;
179 cricket::MediaSessionDescriptionFactory session_desc_factory_; 188 cricket::MediaSessionDescriptionFactory session_desc_factory_;
180 uint64_t session_version_; 189 uint64_t session_version_;
181 const rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_; 190 const rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
182 const rtc::scoped_refptr<WebRtcIdentityRequestObserver> 191 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>
183 identity_request_observer_; 192 identity_request_observer_;
184 // TODO(jiayl): remove the dependency on session once bug 2264 is fixed. 193 // TODO(jiayl): remove the dependency on session once bug 2264 is fixed.
185 WebRtcSession* const session_; 194 WebRtcSession* const session_;
186 const std::string session_id_; 195 const std::string session_id_;
196 const cricket::DataChannelType data_channel_type_;
187 CertificateRequestState certificate_request_state_; 197 CertificateRequestState certificate_request_state_;
188 198
189 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory); 199 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory);
190 }; 200 };
191 } // namespace webrtc 201 } // namespace webrtc
192 202
193 #endif // TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_ 203 #endif // TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | talk/app/webrtc/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698