From b627f676b3be77e8d9da55104d6553d6972cd2a1 Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Thu, 28 Nov 2013 14:00:09 +0000 Subject: [PATCH] Fixes a crash in the pacer where it fails to find a normal prio packet if there are no high prio packets, given that the queue has grown too large. BUG=2682 R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/4599005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5190 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/pacing/paced_sender.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/pacing/paced_sender.cc b/webrtc/modules/pacing/paced_sender.cc index 7db408996b..7d4e81b033 100644 --- a/webrtc/modules/pacing/paced_sender.cc +++ b/webrtc/modules/pacing/paced_sender.cc @@ -326,6 +326,7 @@ void PacedSender::UpdateBytesPerInterval(uint32_t delta_time_ms) { // MUST have critsect_ when calling. bool PacedSender::ShouldSendNextPacket(paced_sender::PacketList** packet_list) { + *packet_list = NULL; if (media_budget_->bytes_remaining() <= 0) { // All bytes consumed for this interval. // Check if we have not sent in a too long time. @@ -348,8 +349,9 @@ bool PacedSender::ShouldSendNextPacket(paced_sender::PacketList** packet_list) { high_priority_packets_->front().capture_time_ms_; *packet_list = high_priority_packets_.get(); } - if (!normal_priority_packets_->empty() && high_priority_capture_time > - normal_priority_packets_->front().capture_time_ms_) { + if (!normal_priority_packets_->empty() && + (high_priority_capture_time == -1 || high_priority_capture_time > + normal_priority_packets_->front().capture_time_ms_)) { *packet_list = normal_priority_packets_.get(); } if (*packet_list)