Fix a bug where network freeze during CNG causes delay

Wrote a new NetEq unit test to test a network freeze during comfort
noise playout. The network freezes and resumes during the silence
period, and then resumes speech. It was verified that the delay
increased due to the freeze, and this CL contains a fix for that
problem.

BUG=2995
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5701 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org
2014-03-14 12:40:05 +00:00
parent 367000fa8d
commit 24779fe7cc
2 changed files with 142 additions and 17 deletions

View File

@ -874,9 +874,10 @@ int NetEqImpl::GetDecision(Operations* operation,
// Because of timestamp peculiarities, we have to "manually" disallow using
// a CNG packet with the same timestamp as the one that was last played.
// This can happen when using redundancy and will cause the timing to shift.
while (header &&
decoder_database_->IsComfortNoise(header->payloadType) &&
end_timestamp >= header->timestamp) {
while (header && decoder_database_->IsComfortNoise(header->payloadType) &&
(end_timestamp >= header->timestamp ||
end_timestamp + decision_logic_->generated_noise_samples() >
header->timestamp)) {
// Don't use this packet, discard it.
if (packet_buffer_->DiscardNextPacket() != PacketBuffer::kOK) {
assert(false); // Must be ok by design.