Chromium Code Reviews| Index: webrtc/pc/srtptransport.h |
| diff --git a/webrtc/pc/srtptransport.h b/webrtc/pc/srtptransport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6085c0ba7066dd5e7b95246eacfb5c2b0cada21c |
| --- /dev/null |
| +++ b/webrtc/pc/srtptransport.h |
| @@ -0,0 +1,104 @@ |
| +/* |
| + * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_PC_SRTPTRANSPORT_H_ |
| +#define WEBRTC_PC_SRTPTRANSPORT_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| +#include <utility> |
| + |
| +#include "webrtc/pc/rtptransportinternal.h" |
| +#include "webrtc/pc/srtpfilter.h" |
| +#include "webrtc/rtc_base/checks.h" |
| + |
| +namespace webrtc { |
| + |
|
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.
|
| +class SrtpTransport : public RtpTransportInternal { |
| + public: |
| + SrtpTransport(bool rtcp_mux_enabled, const std::string& content_name); |
| + |
| + // TODO(zstein): Consider taking an RtpTransport instead of an |
| + // RtpTransportInternal. |
| + SrtpTransport(std::unique_ptr<RtpTransportInternal> transport, |
| + const std::string& content_name); |
| + |
| + void SetRtcpMuxEnabled(bool enable) override { |
| + rtp_transport_->SetRtcpMuxEnabled(enable); |
| + } |
| + |
| + rtc::PacketTransportInternal* rtp_packet_transport() const override { |
| + return rtp_transport_->rtp_packet_transport(); |
| + } |
| + |
| + void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) override { |
| + rtp_transport_->SetRtpPacketTransport(rtp); |
| + } |
| + |
| + PacketTransportInterface* GetRtpPacketTransport() const override { |
| + return rtp_transport_->GetRtpPacketTransport(); |
| + } |
| + |
| + rtc::PacketTransportInternal* rtcp_packet_transport() const override { |
| + return rtp_transport_->rtcp_packet_transport(); |
| + } |
| + void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override { |
| + rtp_transport_->SetRtcpPacketTransport(rtcp); |
| + } |
| + |
| + PacketTransportInterface* GetRtcpPacketTransport() const override { |
| + return rtp_transport_->GetRtcpPacketTransport(); |
| + } |
| + |
| + bool IsWritable(bool rtcp) const override { |
| + return rtp_transport_->IsWritable(rtcp); |
| + } |
| + |
| + bool SendPacket(bool rtcp, |
| + rtc::CopyOnWriteBuffer* packet, |
| + const rtc::PacketOptions& options, |
| + int flags) override; |
| + |
| + bool HandlesPayloadType(int payload_type) const override { |
| + return rtp_transport_->HandlesPayloadType(payload_type); |
| + } |
| + |
| + void AddHandledPayloadType(int payload_type) override { |
| + rtp_transport_->AddHandledPayloadType(payload_type); |
| + } |
| + |
| + RtcpParameters GetRtcpParameters() const override { |
| + return rtp_transport_->GetRtcpParameters(); |
| + } |
| + |
| + RTCError SetRtcpParameters(const RtcpParameters& parameters) override { |
| + return rtp_transport_->SetRtcpParameters(parameters); |
| + } |
| + |
| + // TODO(zstein): Remove this when we remove RtpTransportAdapter. |
| + RtpTransportAdapter* GetInternal() override { return nullptr; } |
| + |
| + private: |
| + void ConnectToRtpTransport(); |
| + |
| + void OnPacketReceived(bool rtcp, |
| + rtc::CopyOnWriteBuffer* packet, |
| + const rtc::PacketTime& packet_time); |
| + |
| + void OnReadyToSend(bool ready) { SignalReadyToSend(ready); } |
| + |
| + const std::string content_name_; |
| + |
| + std::unique_ptr<RtpTransportInternal> rtp_transport_; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_PC_SRTPTRANSPORT_H_ |