Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_PC_SRTPTRANSPORT_H_ | |
| 12 #define WEBRTC_PC_SRTPTRANSPORT_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <string> | |
| 16 #include <utility> | |
| 17 | |
| 18 #include "webrtc/pc/rtptransportinternal.h" | |
| 19 #include "webrtc/pc/srtpfilter.h" | |
| 20 #include "webrtc/rtc_base/checks.h" | |
| 21 | |
| 22 namespace webrtc { | |
| 23 | |
|
Taylor Brandstetter
2017/07/18 22:17:53
Can you leave a comment summarizing the current st
Zach Stein
2017/07/18 23:26:31
Done.
| |
| 24 class SrtpTransport : public RtpTransportInternal { | |
| 25 public: | |
| 26 SrtpTransport(bool rtcp_mux_enabled, const std::string& content_name); | |
| 27 | |
| 28 // TODO(zstein): Consider taking an RtpTransport instead of an | |
| 29 // RtpTransportInternal. | |
| 30 SrtpTransport(std::unique_ptr<RtpTransportInternal> transport, | |
| 31 const std::string& content_name); | |
| 32 | |
| 33 void SetRtcpMuxEnabled(bool enable) override { | |
| 34 rtp_transport_->SetRtcpMuxEnabled(enable); | |
| 35 } | |
| 36 | |
| 37 rtc::PacketTransportInternal* rtp_packet_transport() const override { | |
| 38 return rtp_transport_->rtp_packet_transport(); | |
| 39 } | |
| 40 | |
| 41 void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) override { | |
| 42 rtp_transport_->SetRtpPacketTransport(rtp); | |
| 43 } | |
| 44 | |
| 45 PacketTransportInterface* GetRtpPacketTransport() const override { | |
| 46 return rtp_transport_->GetRtpPacketTransport(); | |
| 47 } | |
| 48 | |
| 49 rtc::PacketTransportInternal* rtcp_packet_transport() const override { | |
| 50 return rtp_transport_->rtcp_packet_transport(); | |
| 51 } | |
| 52 void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override { | |
| 53 rtp_transport_->SetRtcpPacketTransport(rtcp); | |
| 54 } | |
| 55 | |
| 56 PacketTransportInterface* GetRtcpPacketTransport() const override { | |
| 57 return rtp_transport_->GetRtcpPacketTransport(); | |
| 58 } | |
| 59 | |
| 60 bool IsWritable(bool rtcp) const override { | |
| 61 return rtp_transport_->IsWritable(rtcp); | |
| 62 } | |
| 63 | |
| 64 bool SendPacket(bool rtcp, | |
| 65 rtc::CopyOnWriteBuffer* packet, | |
| 66 const rtc::PacketOptions& options, | |
| 67 int flags) override; | |
| 68 | |
| 69 bool HandlesPayloadType(int payload_type) const override { | |
| 70 return rtp_transport_->HandlesPayloadType(payload_type); | |
| 71 } | |
| 72 | |
| 73 void AddHandledPayloadType(int payload_type) override { | |
| 74 rtp_transport_->AddHandledPayloadType(payload_type); | |
| 75 } | |
| 76 | |
| 77 RtcpParameters GetRtcpParameters() const override { | |
| 78 return rtp_transport_->GetRtcpParameters(); | |
| 79 } | |
| 80 | |
| 81 RTCError SetRtcpParameters(const RtcpParameters& parameters) override { | |
| 82 return rtp_transport_->SetRtcpParameters(parameters); | |
| 83 } | |
| 84 | |
| 85 // TODO(zstein): Remove this when we remove RtpTransportAdapter. | |
| 86 RtpTransportAdapter* GetInternal() override { return nullptr; } | |
| 87 | |
| 88 private: | |
| 89 void ConnectToRtpTransport(); | |
| 90 | |
| 91 void OnPacketReceived(bool rtcp, | |
| 92 rtc::CopyOnWriteBuffer* packet, | |
| 93 const rtc::PacketTime& packet_time); | |
| 94 | |
| 95 void OnReadyToSend(bool ready) { SignalReadyToSend(ready); } | |
| 96 | |
| 97 const std::string content_name_; | |
| 98 | |
| 99 std::unique_ptr<RtpTransportInternal> rtp_transport_; | |
| 100 }; | |
| 101 | |
| 102 } // namespace webrtc | |
| 103 | |
| 104 #endif // WEBRTC_PC_SRTPTRANSPORT_H_ | |
| OLD | NEW |