Sebastian Jansson | b537496 | 2018-02-07 13:26:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | #include "modules/pacing/packet_queue_interface.h" |
| 12 | |
| 13 | namespace webrtc { |
| 14 | |
| 15 | PacketQueueInterface::Packet::Packet(RtpPacketSender::Priority priority, |
| 16 | uint32_t ssrc, |
| 17 | uint16_t seq_number, |
| 18 | int64_t capture_time_ms, |
| 19 | int64_t enqueue_time_ms, |
| 20 | size_t length_in_bytes, |
| 21 | bool retransmission, |
| 22 | uint64_t enqueue_order) |
| 23 | : priority(priority), |
| 24 | ssrc(ssrc), |
| 25 | sequence_number(seq_number), |
| 26 | capture_time_ms(capture_time_ms), |
| 27 | enqueue_time_ms(enqueue_time_ms), |
| 28 | sum_paused_ms(0), |
| 29 | bytes(length_in_bytes), |
| 30 | retransmission(retransmission), |
| 31 | enqueue_order(enqueue_order) {} |
| 32 | |
| 33 | PacketQueueInterface::Packet::Packet(const Packet& other) = default; |
| 34 | |
| 35 | PacketQueueInterface::Packet::~Packet() {} |
| 36 | |
| 37 | bool PacketQueueInterface::Packet::operator<( |
| 38 | const PacketQueueInterface::Packet& other) const { |
| 39 | if (priority != other.priority) |
| 40 | return priority > other.priority; |
| 41 | if (retransmission != other.retransmission) |
| 42 | return other.retransmission; |
| 43 | |
| 44 | return enqueue_order > other.enqueue_order; |
| 45 | } |
| 46 | } // namespace webrtc |