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

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

Issue 2714813004: Create the SrtpTransportInterface. (Closed)
Patch Set: Created 3 years, 9 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
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_ORTC_RTPTRANSPORTADAPTER_H_
12 #define WEBRTC_ORTC_RTPTRANSPORTADAPTER_H_
13
14 #include <memory>
15 #include <vector>
16
17 #include "webrtc/api/ortc/srtptransportinterface.h"
18 #include "webrtc/api/rtcerror.h"
19 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/base/sigslot.h"
21 #include "webrtc/media/base/streamparams.h"
22 #include "webrtc/ortc/rtptransportcontrolleradapter.h"
23 #include "webrtc/pc/channel.h"
24
25 namespace webrtc {
26
27 // Implementation of RtpTransportInterface to be used with RtpSenderAdapter,
Taylor Brandstetter 2017/02/24 18:57:58 This comment should be updated. It should also men
Zhi Huang 2017/02/27 05:16:00 Done.
28 // RtpReceiverAdapter, and RtpTransportControllerAdapter classes.
29 //
30 // TODO(deadbeef): When BaseChannel is split apart into separate
31 // "RtpTransport"/"RtpTransceiver"/"RtpSender"/"RtpReceiver" objects, this
32 // adapter object can be removed.
33 class RtpTransportAdapter : public SrtpTransportInterface {
34 public:
35 // |rtp| can't be null. |rtcp| can if RTCP muxing is used immediately (meaning
36 // |rtcp_parameters.mux| is also true).
37 static RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateProxied(
38 const RtcpParameters& rtcp_parameters,
39 PacketTransportInterface* rtp,
40 PacketTransportInterface* rtcp,
41 RtpTransportControllerAdapter* rtp_transport_controller);
42
43 static RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> CreateSrtpProxied(
44 const RtcpParameters& rtcp_parameters,
45 PacketTransportInterface* rtp,
46 PacketTransportInterface* rtcp,
47 RtpTransportControllerAdapter* rtp_transport_controller);
48
49 ~RtpTransportAdapter() override;
50
51 // RtpTransportInterface implementation.
52 PacketTransportInterface* GetRtpPacketTransport() const override;
53 PacketTransportInterface* GetRtcpPacketTransport() const override;
54 RTCError SetRtcpParameters(const RtcpParameters& parameters) override;
55 RtcpParameters GetRtcpParameters() const override { return rtcp_parameters_; }
56
57 // SRTP specific implementation.
58 RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override;
59 RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override;
60
61 // Methods used internally by OrtcFactory.
62 RtpTransportControllerAdapter* rtp_transport_controller() {
63 return rtp_transport_controller_;
64 }
65 void TakeOwnershipOfRtpTransportController(
66 std::unique_ptr<RtpTransportControllerInterface> controller);
67
68 // Methods used internally by OrtcAudio/VideoSender.
69 bool TransportReadyToSendAndReceive();
70
71 // Used by RtpTransportControllerAdapter to tell when it should stop
72 // returning this transport from GetTransports().
73 sigslot::signal1<RtpTransportAdapter*> SignalDestroyed;
74
75 protected:
76 RtpTransportAdapter* GetInternal() override { return this; }
77
78 private:
79 RtpTransportAdapter(const RtcpParameters& rtcp_parameters,
80 PacketTransportInterface* rtp,
81 PacketTransportInterface* rtcp,
82 RtpTransportControllerAdapter* rtp_transport_controller,
83 bool is_srtp_transport);
84
85 PacketTransportInterface* rtp_packet_transport_;
86 PacketTransportInterface* rtcp_packet_transport_;
87 RtpTransportControllerAdapter* rtp_transport_controller_;
88 // Non-null if this class owns the transport controller.
89 std::unique_ptr<RtpTransportControllerInterface>
90 owned_rtp_transport_controller_;
91 RtcpParameters rtcp_parameters_;
92
93 bool is_srtp_transport_;
94 bool have_send_key_;
95 bool have_receive_key_;
96
97 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportAdapter);
98 };
99
100 } // namespace webrtc
101
102 #endif // WEBRTC_ORTC_RTPTRANSPORTADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698