Implement a test for an old corner-case in NetEq

This CL implements a unit test to cover an case where comfort noise
packets should be discarded. The situation arises when NetEq gets a
duplicate comfort noise packet. Without this check, the duplicate would
be decoded, and a the timing would shift.

As it turned out, the corner-case funcionality was not completely
accurate in NetEq4. This is because decision_logic_::cng_state_ is set
after the corner-case check. In the old NetEq3, the corresponding state
was changed before the check. This is now fixed.

R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5685 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org
2014-03-12 10:26:52 +00:00
parent 04ea23234a
commit ca8cb95364
2 changed files with 80 additions and 3 deletions

View File

@ -870,7 +870,7 @@ int NetEqImpl::GetDecision(Operations* operation,
}
const RTPHeader* header = packet_buffer_->NextRtpHeader();
if (decision_logic_->CngRfc3389On()) {
if (decision_logic_->CngRfc3389On() || last_mode_ == kModeRfc3389Cng) {
// 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.
@ -878,7 +878,6 @@ int NetEqImpl::GetDecision(Operations* operation,
decoder_database_->IsComfortNoise(header->payloadType) &&
end_timestamp >= header->timestamp) {
// Don't use this packet, discard it.
// TODO(hlundin): Write test for this case.
if (packet_buffer_->DiscardNextPacket() != PacketBuffer::kOK) {
assert(false); // Must be ok by design.
}