| 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 | #include "video/transport_adapter.h" |
| 12 |
| 13 | #include "rtc_base/checks.h" |
| 14 |
| 15 | namespace webrtc { |
| 16 | namespace internal { |
| 17 |
| 18 | TransportAdapter::TransportAdapter(Transport* transport) |
| 19 | : transport_(transport), enabled_(false) { |
| 20 | RTC_DCHECK(nullptr != transport); |
| 21 | } |
| 22 |
| 23 | TransportAdapter::~TransportAdapter() = default; |
| 24 |
| 25 | bool TransportAdapter::SendRtp(rtc::ArrayView<const uint8_t> packet, |
| 26 | const PacketOptions& options) { |
| 27 | if (!enabled_.load()) |
| 28 | return false; |
| 29 |
| 30 | return transport_->SendRtp(packet, options); |
| 31 | } |
| 32 |
| 33 | bool TransportAdapter::SendRtcp(rtc::ArrayView<const uint8_t> packet) { |
| 34 | if (!enabled_.load()) |
| 35 | return false; |
| 36 |
| 37 | return transport_->SendRtcp(packet); |
| 38 | } |
| 39 |
| 40 | void TransportAdapter::Enable() { |
| 41 | enabled_.store(true); |
| 42 | } |
| 43 |
| 44 | void TransportAdapter::Disable() { |
| 45 | enabled_.store(false); |
| 46 | } |
| 47 |
| 48 | } // namespace internal |
| 49 | } // namespace webrtc |
| 50 |