Fix problem with late packets in NetEq

Since r7255, it could happen that an old packet would block the decoding
process until enough packet was received for the buffer to flush. This
CL fixes that by:
- Partially reverting r7255;
- Remove recent old packets before taking a decision for GetAudio;
- Remove all old packets after a packet has been extracted for decoding;
- Adding tests for reordered packets.

BUG=chrome:423985
R=tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/25079004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7612 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org
2014-11-04 14:03:58 +00:00
parent 09cc686c8b
commit 52b42cb069
8 changed files with 207 additions and 20 deletions

View File

@ -216,12 +216,12 @@ int PacketBuffer::DiscardNextPacket() {
return kOK;
}
int PacketBuffer::DiscardOldPackets(uint32_t timestamp_limit) {
while (!Empty() &&
timestamp_limit != buffer_.front()->header.timestamp &&
static_cast<uint32_t>(timestamp_limit
- buffer_.front()->header.timestamp) <
0xFFFFFFFF / 2) {
int PacketBuffer::DiscardOldPackets(uint32_t timestamp_limit,
uint32_t horizon_samples) {
while (!Empty() && timestamp_limit != buffer_.front()->header.timestamp &&
IsObsoleteTimestamp(buffer_.front()->header.timestamp,
timestamp_limit,
horizon_samples)) {
if (DiscardNextPacket() != kOK) {
assert(false); // Must be ok by design.
}