Renamed PacketQueue2 to RoundRobinPacketQueue.

The previous name packet queue 2 had no indication on what the
difference was compared to the regular packet queue. This rename makes
it easier to understand the codebase.

Additionally the PacketQueueInterface class was introduced to make the
class hierarchy easier to follow. The round robin packet queue did not
extend the packet queue so there was no reason for inheriting from the
specific implementation.

Bug: None
Change-Id: Idbce081c751fbacd927632f5e71220887d0b5991
Reviewed-on: https://webrtc-review.googlesource.com/49120
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21931}
This commit is contained in:
Sebastian Jansson
2018-02-07 13:26:38 +01:00
committed by Commit Bot
parent 17cdcbb57b
commit b537496520
9 changed files with 191 additions and 116 deletions

View File

@ -25,28 +25,6 @@
namespace webrtc {
PacketQueue::Packet::Packet(RtpPacketSender::Priority priority,
uint32_t ssrc,
uint16_t seq_number,
int64_t capture_time_ms,
int64_t enqueue_time_ms,
size_t length_in_bytes,
bool retransmission,
uint64_t enqueue_order)
: priority(priority),
ssrc(ssrc),
sequence_number(seq_number),
capture_time_ms(capture_time_ms),
enqueue_time_ms(enqueue_time_ms),
sum_paused_ms(0),
bytes(length_in_bytes),
retransmission(retransmission),
enqueue_order(enqueue_order) {}
PacketQueue::Packet::Packet(const Packet& other) = default;
PacketQueue::Packet::~Packet() {}
PacketQueue::PacketQueue(const Clock* clock)
: bytes_(0),
clock_(clock),
@ -69,17 +47,17 @@ void PacketQueue::Push(const Packet& packet) {
bytes_ += packet.bytes;
}
const PacketQueue::Packet& PacketQueue::BeginPop() {
const PacketQueue::Packet& packet = *prio_queue_.top();
const PacketQueueInterface::Packet& PacketQueue::BeginPop() {
const Packet& packet = *prio_queue_.top();
prio_queue_.pop();
return packet;
}
void PacketQueue::CancelPop(const PacketQueue::Packet& packet) {
void PacketQueue::CancelPop(const Packet& packet) {
prio_queue_.push(&(*packet.this_it));
}
void PacketQueue::FinalizePop(const PacketQueue::Packet& packet) {
void PacketQueue::FinalizePop(const Packet& packet) {
bytes_ -= packet.bytes;
int64_t packet_queue_time_ms = time_last_updated_ - packet.enqueue_time_ms;
RTC_DCHECK_LE(packet.sum_paused_ms, packet_queue_time_ms);