OLD | NEW |
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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // is used to implement both a secure and insecure RTP transport. | 29 // is used to implement both a secure and insecure RTP transport. |
30 // | 30 // |
31 // TODO(deadbeef): When BaseChannel is split apart into separate | 31 // TODO(deadbeef): When BaseChannel is split apart into separate |
32 // "RtpTransport"/"RtpTransceiver"/"RtpSender"/"RtpReceiver" objects, this | 32 // "RtpTransport"/"RtpTransceiver"/"RtpSender"/"RtpReceiver" objects, this |
33 // adapter object can be removed. | 33 // adapter object can be removed. |
34 class RtpTransportAdapter : public SrtpTransportInterface { | 34 class RtpTransportAdapter : public SrtpTransportInterface { |
35 public: | 35 public: |
36 // |rtp| can't be null. |rtcp| can if RTCP muxing is used immediately (meaning | 36 // |rtp| can't be null. |rtcp| can if RTCP muxing is used immediately (meaning |
37 // |rtcp_parameters.mux| is also true). | 37 // |rtcp_parameters.mux| is also true). |
38 static RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateProxied( | 38 static RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateProxied( |
39 const RtcpParameters& rtcp_parameters, | 39 const RtpTransportParameters& rtcp_parameters, |
40 PacketTransportInterface* rtp, | 40 PacketTransportInterface* rtp, |
41 PacketTransportInterface* rtcp, | 41 PacketTransportInterface* rtcp, |
42 RtpTransportControllerAdapter* rtp_transport_controller); | 42 RtpTransportControllerAdapter* rtp_transport_controller); |
43 | 43 |
44 static RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> CreateSrtpProxied( | 44 static RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> CreateSrtpProxied( |
45 const RtcpParameters& rtcp_parameters, | 45 const RtpTransportParameters& rtcp_parameters, |
46 PacketTransportInterface* rtp, | 46 PacketTransportInterface* rtp, |
47 PacketTransportInterface* rtcp, | 47 PacketTransportInterface* rtcp, |
48 RtpTransportControllerAdapter* rtp_transport_controller); | 48 RtpTransportControllerAdapter* rtp_transport_controller); |
49 | 49 |
50 ~RtpTransportAdapter() override; | 50 ~RtpTransportAdapter() override; |
51 | 51 |
52 // RtpTransportInterface implementation. | 52 // RtpTransportInterface implementation. |
53 PacketTransportInterface* GetRtpPacketTransport() const override; | 53 PacketTransportInterface* GetRtpPacketTransport() const override; |
54 PacketTransportInterface* GetRtcpPacketTransport() const override; | 54 PacketTransportInterface* GetRtcpPacketTransport() const override; |
55 RTCError SetRtcpParameters(const RtcpParameters& parameters) override; | 55 RTCError SetParameters(const RtpTransportParameters& parameters) override; |
56 RtcpParameters GetRtcpParameters() const override { return rtcp_parameters_; } | 56 RtpTransportParameters GetParameters() const override { return parameters_; } |
57 | 57 |
58 // SRTP specific implementation. | 58 // SRTP specific implementation. |
59 RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override; | 59 RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override; |
60 RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override; | 60 RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override; |
61 | 61 |
62 // Methods used internally by OrtcFactory. | 62 // Methods used internally by OrtcFactory. |
63 RtpTransportControllerAdapter* rtp_transport_controller() { | 63 RtpTransportControllerAdapter* rtp_transport_controller() { |
64 return rtp_transport_controller_; | 64 return rtp_transport_controller_; |
65 } | 65 } |
66 void TakeOwnershipOfRtpTransportController( | 66 void TakeOwnershipOfRtpTransportController( |
67 std::unique_ptr<RtpTransportControllerInterface> controller); | 67 std::unique_ptr<RtpTransportControllerInterface> controller); |
68 | 68 |
69 // Used by RtpTransportControllerAdapter to tell when it should stop | 69 // Used by RtpTransportControllerAdapter to tell when it should stop |
70 // returning this transport from GetTransports(). | 70 // returning this transport from GetTransports(). |
71 sigslot::signal1<RtpTransportAdapter*> SignalDestroyed; | 71 sigslot::signal1<RtpTransportAdapter*> SignalDestroyed; |
72 | 72 |
73 // Used by the RtpTransportControllerAdapter to tell if an rtp sender or | 73 // Used by the RtpTransportControllerAdapter to tell if an rtp sender or |
74 // receiver can be created. | 74 // receiver can be created. |
75 bool is_srtp_transport() { return is_srtp_transport_; } | 75 bool is_srtp_transport() { return is_srtp_transport_; } |
76 // Used by the RtpTransportControllerAdapter to set keys for senders and | 76 // Used by the RtpTransportControllerAdapter to set keys for senders and |
77 // receivers. | 77 // receivers. |
78 rtc::Optional<cricket::CryptoParams> send_key() { return send_key_; } | 78 rtc::Optional<cricket::CryptoParams> send_key() { return send_key_; } |
79 rtc::Optional<cricket::CryptoParams> receive_key() { return receive_key_; } | 79 rtc::Optional<cricket::CryptoParams> receive_key() { return receive_key_; } |
80 | 80 |
81 protected: | 81 protected: |
82 RtpTransportAdapter* GetInternal() override { return this; } | 82 RtpTransportAdapter* GetInternal() override { return this; } |
83 | 83 |
84 private: | 84 private: |
85 RtpTransportAdapter(const RtcpParameters& rtcp_parameters, | 85 RtpTransportAdapter(const RtpTransportParameters& parameters, |
86 PacketTransportInterface* rtp, | 86 PacketTransportInterface* rtp, |
87 PacketTransportInterface* rtcp, | 87 PacketTransportInterface* rtcp, |
88 RtpTransportControllerAdapter* rtp_transport_controller, | 88 RtpTransportControllerAdapter* rtp_transport_controller, |
89 bool is_srtp_transport); | 89 bool is_srtp_transport); |
90 | 90 |
91 PacketTransportInterface* rtp_packet_transport_; | 91 PacketTransportInterface* rtp_packet_transport_; |
92 PacketTransportInterface* rtcp_packet_transport_; | 92 PacketTransportInterface* rtcp_packet_transport_; |
93 RtpTransportControllerAdapter* rtp_transport_controller_; | 93 RtpTransportControllerAdapter* rtp_transport_controller_; |
94 // Non-null if this class owns the transport controller. | 94 // Non-null if this class owns the transport controller. |
95 std::unique_ptr<RtpTransportControllerInterface> | 95 std::unique_ptr<RtpTransportControllerInterface> |
96 owned_rtp_transport_controller_; | 96 owned_rtp_transport_controller_; |
97 RtcpParameters rtcp_parameters_; | 97 RtpTransportParameters parameters_; |
98 | 98 |
99 // SRTP specific members. | 99 // SRTP specific members. |
100 rtc::Optional<cricket::CryptoParams> send_key_; | 100 rtc::Optional<cricket::CryptoParams> send_key_; |
101 rtc::Optional<cricket::CryptoParams> receive_key_; | 101 rtc::Optional<cricket::CryptoParams> receive_key_; |
102 bool is_srtp_transport_; | 102 bool is_srtp_transport_; |
103 | 103 |
104 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportAdapter); | 104 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportAdapter); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace webrtc | 107 } // namespace webrtc |
108 | 108 |
109 #endif // WEBRTC_ORTC_RTPTRANSPORTADAPTER_H_ | 109 #endif // WEBRTC_ORTC_RTPTRANSPORTADAPTER_H_ |
OLD | NEW |