Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_PC_RTPTRANSPORT_H_ | 11 #ifndef WEBRTC_PC_RTPTRANSPORT_H_ |
| 12 #define WEBRTC_PC_RTPTRANSPORT_H_ | 12 #define WEBRTC_PC_RTPTRANSPORT_H_ |
| 13 | 13 |
| 14 #include "webrtc/api/ortc/rtptransportinterface.h" | |
| 15 | |
| 14 namespace rtc { | 16 namespace rtc { |
| 15 | 17 |
| 16 class PacketTransportInternal; | 18 class PacketTransportInternal; |
| 17 | 19 |
| 18 } // namespace rtc | 20 } // namespace rtc |
| 19 | 21 |
| 20 namespace webrtc { | 22 namespace webrtc { |
| 21 | 23 |
| 22 class RtpTransport { | 24 class PacketTransportWrapper : public PacketTransportInterface { |
|
Taylor Brandstetter
2017/04/07 04:16:03
I was confused about why this was necessary until
Zach Stein
2017/04/10 22:37:43
Done.
| |
| 25 public: | |
| 26 PacketTransportWrapper() = default; | |
| 27 explicit PacketTransportWrapper(rtc::PacketTransportInternal* transport) | |
| 28 : transport_(transport) {} | |
| 29 | |
| 30 rtc::PacketTransportInternal* transport() const { return transport_; } | |
| 31 | |
| 32 void set_transport(rtc::PacketTransportInternal* transport) { | |
| 33 transport_ = transport; | |
| 34 } | |
| 35 | |
| 36 protected: | |
| 37 rtc::PacketTransportInternal* GetInternal() { return transport_; } | |
| 38 | |
| 39 private: | |
| 40 rtc::PacketTransportInternal* transport_ = nullptr; | |
| 41 }; | |
| 42 | |
| 43 class RtpTransport : public RtpTransportInterface { | |
| 23 public: | 44 public: |
| 24 RtpTransport(const RtpTransport&) = delete; | 45 RtpTransport(const RtpTransport&) = delete; |
| 25 RtpTransport& operator=(const RtpTransport&) = delete; | 46 RtpTransport& operator=(const RtpTransport&) = delete; |
| 26 | 47 |
| 27 explicit RtpTransport(bool rtcp_mux_required) | 48 explicit RtpTransport(bool rtcp_mux_required); |
| 28 : rtcp_mux_required_(rtcp_mux_required) {} | |
| 29 | 49 |
| 30 bool rtcp_mux_required() const { return rtcp_mux_required_; } | 50 bool rtcp_mux_required() const { return rtcp_mux_required_; } |
| 31 | 51 |
| 32 rtc::PacketTransportInternal* rtp_packet_transport() const { | 52 rtc::PacketTransportInternal* rtp_packet_transport() const { |
| 33 return rtp_packet_transport_; | 53 return rtp_packet_transport_wrapper_->transport(); |
| 34 } | 54 } |
| 35 void set_rtp_packet_transport(rtc::PacketTransportInternal* rtp) { | 55 void set_rtp_packet_transport(rtc::PacketTransportInternal* rtp); |
| 36 rtp_packet_transport_ = rtp; | |
| 37 } | |
| 38 | 56 |
| 39 rtc::PacketTransportInternal* rtcp_packet_transport() const { | 57 rtc::PacketTransportInternal* rtcp_packet_transport() const { |
| 40 return rtcp_packet_transport_; | 58 return rtcp_packet_transport_wrapper_->transport(); |
| 41 } | 59 } |
| 42 void set_rtcp_packet_transport(rtc::PacketTransportInternal* rtcp); | 60 void set_rtcp_packet_transport(rtc::PacketTransportInternal* rtcp); |
| 43 | 61 |
| 62 PacketTransportInterface* GetRtpPacketTransport() const override; | |
| 63 PacketTransportInterface* GetRtcpPacketTransport() const override; | |
| 64 | |
| 65 RTCError SetRtcpParameters(const RtcpParameters& parameters) override; | |
| 66 RtcpParameters GetRtcpParameters() const override; | |
|
Taylor Brandstetter
2017/04/07 04:16:03
Since these methods aren't used anywhere yet, can
Zach Stein
2017/04/10 22:37:43
Done.
| |
| 67 | |
| 68 protected: | |
| 69 // TODO(zstein): Remove this when we remove RtpTransportAdapter. | |
| 70 RtpTransportAdapter* GetInternal() override; | |
| 71 | |
| 44 private: | 72 private: |
| 45 // True if RTCP-multiplexing is required. rtcp_packet_transport_ should | 73 // True if RTCP-multiplexing is required. rtcp_packet_transport_ should |
| 46 // always be null in this case. | 74 // always be null in this case. |
| 47 const bool rtcp_mux_required_; | 75 const bool rtcp_mux_required_; |
| 48 | 76 |
| 49 // TODO(zstein): Revisit ownership here - transports are currently owned by | 77 std::unique_ptr<PacketTransportWrapper> rtp_packet_transport_wrapper_; |
| 50 // TransportController | 78 std::unique_ptr<PacketTransportWrapper> rtcp_packet_transport_wrapper_; |
| 51 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; | 79 |
| 52 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr; | 80 RtcpParameters rtcp_parameters_; |
| 53 }; | 81 }; |
| 54 | 82 |
| 55 } // namespace webrtc | 83 } // namespace webrtc |
| 56 | 84 |
| 57 #endif // WEBRTC_PC_RTPTRANSPORT_H_ | 85 #endif // WEBRTC_PC_RTPTRANSPORT_H_ |
| OLD | NEW |