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

Side by Side Diff: webrtc/ortc/rtptransportadapter.cc

Issue 2981513002: Wire up RTP keep-alive in ortc api. (Closed)
Patch Set: wip Created 3 years, 5 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 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/ortc/rtptransportadapter.h" 11 #include "webrtc/ortc/rtptransportadapter.h"
12 12
13 #include <algorithm> // For std::find. 13 #include <algorithm> // For std::find.
14 #include <set> 14 #include <set>
15 #include <sstream> 15 #include <sstream>
16 #include <utility> // For std::move. 16 #include <utility> // For std::move.
17 17
18 #include "webrtc/api/proxy.h" 18 #include "webrtc/api/proxy.h"
19 #include "webrtc/rtc_base/logging.h" 19 #include "webrtc/rtc_base/logging.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 BEGIN_OWNED_PROXY_MAP(RtpTransport) 23 BEGIN_OWNED_PROXY_MAP(RtpTransport)
24 PROXY_SIGNALING_THREAD_DESTRUCTOR() 24 PROXY_SIGNALING_THREAD_DESTRUCTOR()
25 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport) 25 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport)
26 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport) 26 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport)
27 PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&) 27 PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&)
28 PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters) 28 PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters)
29 PROXY_METHOD1(RTCError,
30 SetRtpTransportParameters,
31 const RtpTransportParameters&)
32 PROXY_CONSTMETHOD0(RtpTransportParameters, GetRtpTransportParameters)
29 protected: 33 protected:
30 RtpTransportAdapter* GetInternal() override { 34 RtpTransportAdapter* GetInternal() override {
31 return internal(); 35 return internal();
32 } 36 }
33 END_PROXY_MAP() 37 END_PROXY_MAP()
34 38
35 BEGIN_OWNED_PROXY_MAP(SrtpTransport) 39 BEGIN_OWNED_PROXY_MAP(SrtpTransport)
36 PROXY_SIGNALING_THREAD_DESTRUCTOR() 40 PROXY_SIGNALING_THREAD_DESTRUCTOR()
37 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport) 41 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtpPacketTransport)
38 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport) 42 PROXY_CONSTMETHOD0(PacketTransportInterface*, GetRtcpPacketTransport)
39 PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&) 43 PROXY_METHOD1(RTCError, SetRtcpParameters, const RtcpParameters&)
40 PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters) 44 PROXY_CONSTMETHOD0(RtcpParameters, GetRtcpParameters)
45 PROXY_METHOD1(RTCError,
46 SetRtpTransportParameters,
47 const RtpTransportParameters&)
48 PROXY_CONSTMETHOD0(RtpTransportParameters, GetRtpTransportParameters)
41 PROXY_METHOD1(RTCError, SetSrtpSendKey, const cricket::CryptoParams&) 49 PROXY_METHOD1(RTCError, SetSrtpSendKey, const cricket::CryptoParams&)
42 PROXY_METHOD1(RTCError, SetSrtpReceiveKey, const cricket::CryptoParams&) 50 PROXY_METHOD1(RTCError, SetSrtpReceiveKey, const cricket::CryptoParams&)
43 protected: 51 protected:
44 RtpTransportAdapter* GetInternal() override { 52 RtpTransportAdapter* GetInternal() override {
45 return internal(); 53 return internal();
46 } 54 }
47 END_PROXY_MAP() 55 END_PROXY_MAP()
48 56
49 // static 57 // static
50 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> 58 RTCErrorOr<std::unique_ptr<RtpTransportInterface>>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (!err.ok()) { 179 if (!err.ok()) {
172 return err; 180 return err;
173 } 181 }
174 rtcp_parameters_ = copy; 182 rtcp_parameters_ = copy;
175 if (rtcp_parameters_.mux) { 183 if (rtcp_parameters_.mux) {
176 rtcp_packet_transport_ = nullptr; 184 rtcp_packet_transport_ = nullptr;
177 } 185 }
178 return RTCError::OK(); 186 return RTCError::OK();
179 } 187 }
180 188
189 RTCError RtpTransportAdapter::SetRtpTransportParameters(
190 const RtpTransportParameters& parameters) {
191 RTCError err =
192 rtp_transport_controller_->SetRtpTransportParameters(parameters);
Taylor Brandstetter 2017/07/12 16:19:50 Ok, so setting RTP transport parameters on one Rtp
sprang_webrtc 2017/07/16 09:34:03 That was the idea, since the keep-alive is about k
Taylor Brandstetter 2017/07/17 23:13:11 We may be confusing terminology. Here's what the
ilnik 2017/07/21 12:21:18 Done.
193 if (!err.ok()) {
194 return err;
195 }
196 rtp_transport_parameters_ = parameters;
197 return RTCError::OK();
198 }
199
200 RtpTransportParameters RtpTransportAdapter::GetRtpTransportParameters() const {
201 return rtp_transport_parameters_;
202 }
203
181 RTCError RtpTransportAdapter::SetSrtpSendKey( 204 RTCError RtpTransportAdapter::SetSrtpSendKey(
182 const cricket::CryptoParams& params) { 205 const cricket::CryptoParams& params) {
183 if (send_key_) { 206 if (send_key_) {
184 LOG_AND_RETURN_ERROR( 207 LOG_AND_RETURN_ERROR(
185 webrtc::RTCErrorType::UNSUPPORTED_OPERATION, 208 webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
186 "Setting the SRTP send key twice is currently unsupported."); 209 "Setting the SRTP send key twice is currently unsupported.");
187 } 210 }
188 if (receive_key_ && receive_key_->cipher_suite != params.cipher_suite) { 211 if (receive_key_ && receive_key_->cipher_suite != params.cipher_suite) {
189 LOG_AND_RETURN_ERROR( 212 LOG_AND_RETURN_ERROR(
190 webrtc::RTCErrorType::UNSUPPORTED_OPERATION, 213 webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
(...skipping 13 matching lines...) Expand all
204 if (send_key_ && send_key_->cipher_suite != params.cipher_suite) { 227 if (send_key_ && send_key_->cipher_suite != params.cipher_suite) {
205 LOG_AND_RETURN_ERROR( 228 LOG_AND_RETURN_ERROR(
206 webrtc::RTCErrorType::UNSUPPORTED_OPERATION, 229 webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
207 "The send key and receive key must have the same cipher suite."); 230 "The send key and receive key must have the same cipher suite.");
208 } 231 }
209 receive_key_ = rtc::Optional<cricket::CryptoParams>(params); 232 receive_key_ = rtc::Optional<cricket::CryptoParams>(params);
210 return RTCError::OK(); 233 return RTCError::OK();
211 } 234 }
212 235
213 } // namespace webrtc 236 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698