diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc index ce8d86d36a..86f166bcf0 100644 --- a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc @@ -958,34 +958,34 @@ class AcmReceiverBitExactnessOldApi : public ::testing::Test { #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \ defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) TEST_F(AcmReceiverBitExactnessOldApi, 8kHzOutput) { - Run(8000, PlatformChecksum("90be25dd9505005aaadf91b77ee31624", - "ac6dc4b5bf6d277f693889c4c916882e", - "a607f7d0ba98683c9c236217f86aaa6b", - "4a54f6ec712bda58484a388e1a332b42"), + Run(8000, PlatformChecksum("86f0e58421dafe3471e1bcd62316174e", + "e2c2176b822f109eab2c3317ff1f3a89", + "9c1058831bef8836d5880f86f03f02cd", + "7294944a869a39085ae69278dca875ad"), std::vector()); } TEST_F(AcmReceiverBitExactnessOldApi, 16kHzOutput) { - Run(16000, PlatformChecksum("2c713197d41becd52c1ceecbd2b9f687", - "130cc2a43063c74197122e3760690e7d", - "cdc3d88f6d8e497d4e00c62c0e6dbb3c", - "83edb67c157d0e3a0fb9f7d7b1ce5dc7"), + Run(16000, PlatformChecksum("0b895074ede8d93ff7d4b03e48ff4353", + "9b92ee1731bc07e7a802c46883551029", + "1a29721666a594cc56688b442790d0f9", + "c061a9486003d0c096504905521d0fe7"), std::vector()); } TEST_F(AcmReceiverBitExactnessOldApi, 32kHzOutput) { - Run(32000, PlatformChecksum("fe5851d43c13df66a7ad30fdb124e62f", - "309d24be4b287dc92c340f10a807a11e", - "c4a0e0b2e031d62c693af2a9ff4337ac", - "4cbfc6ab4d704f5d9b4f10406437fda9"), + Run(32000, PlatformChecksum("ed620557bab00d588db0af699dc05df9", + "9472cfaeba10282187a6376aeddba347", + "0071b9962de77b1d71ecd0a0e5accf45", + "c6cca0a4dd27bb77505343a15ea13c77"), std::vector()); } TEST_F(AcmReceiverBitExactnessOldApi, 48kHzOutput) { - Run(48000, PlatformChecksum("a9241f426b4bf2ac650b6d287469a550", - "30374fd4a932df942c1b1120e7b724ad", - "22242dd832824046d48db9ea8a01f84c", - "c7f46bf165400b266d9b57aee02d2747"), + Run(48000, PlatformChecksum("e68904bd63da1bad4b00f4bd221f2325", + "3418d41ee693f8fa6d5878de5a8c95d9", + "861e65072b1a10eec56ffde10c99bbce", + "244bafe12206b7e26276ff7c49fc1795"), std::vector()); } @@ -1043,10 +1043,10 @@ TEST_F(AcmReceiverBitExactnessOldApi, 48kHzOutputExternalDecoder) { std::vector external_decoders; external_decoders.push_back(ed); - Run(48000, PlatformChecksum("a9241f426b4bf2ac650b6d287469a550", - "30374fd4a932df942c1b1120e7b724ad", - "22242dd832824046d48db9ea8a01f84c", - "c7f46bf165400b266d9b57aee02d2747"), + Run(48000, PlatformChecksum("e68904bd63da1bad4b00f4bd221f2325", + "3418d41ee693f8fa6d5878de5a8c95d9", + "861e65072b1a10eec56ffde10c99bbce", + "244bafe12206b7e26276ff7c49fc1795"), external_decoders); EXPECT_CALL(mock_decoder, Die()); diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc index 422252c5ac..024c73d23d 100644 --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc @@ -47,11 +47,6 @@ #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" #include "webrtc/modules/include/module_common_types.h" -// Modify the code to obtain backwards bit-exactness. Once bit-exactness is no -// longer required, this #define should be removed (and the code that it -// enables). -#define LEGACY_BITEXACT - namespace webrtc { NetEqImpl::Dependencies::Dependencies( @@ -1145,15 +1140,8 @@ int NetEqImpl::GetDecision(Operations* operation, return -1; } timestamp_ = header->timestamp; - if (*operation == kRfc3389CngNoPacket -#ifndef LEGACY_BITEXACT - // Without this check, it can happen that a non-CNG packet is sent to - // the CNG decoder as if it was a SID frame. This is clearly a bug, - // but is kept for now to maintain bit-exactness with the test - // vectors. - && decoder_database_->IsComfortNoise(header->payloadType) -#endif - ) { + if (*operation == kRfc3389CngNoPacket && + decoder_database_->IsComfortNoise(header->payloadType)) { // Change decision to CNG packet, since we do have a CNG packet, but it // was considered too early to use. Now, use it anyway. *operation = kRfc3389Cng; @@ -1372,16 +1360,6 @@ int NetEqImpl::Decode(PacketList* packet_list, Operations* operation, reset_decoder_ = false; } -#ifdef LEGACY_BITEXACT - // Due to a bug in old SignalMCU, it could happen that CNG operation was - // decided, but a speech packet was provided. The speech packet will be used - // to update the comfort noise decoder, as if it was a SID frame, which is - // clearly wrong. - if (*operation == kRfc3389Cng) { - return 0; - } -#endif - *decoded_length = 0; // Update codec-internal PLC state. if ((*operation == kMerge) && decoder && decoder->HasDecodePlc()) { @@ -1776,29 +1754,8 @@ int NetEqImpl::DoRfc3389Cng(PacketList* packet_list, bool play_dtmf) { Packet* packet = packet_list->front(); packet_list->pop_front(); if (!decoder_database_->IsComfortNoise(packet->header.payloadType)) { -#ifdef LEGACY_BITEXACT - // This can happen due to a bug in GetDecision. Change the payload type - // to a CNG type, and move on. Note that this means that we are in fact - // sending a non-CNG payload to the comfort noise decoder for decoding. - // Clearly wrong, but will maintain bit-exactness with legacy. - if (fs_hz_ == 8000) { - packet->header.payloadType = - decoder_database_->GetRtpPayloadType(NetEqDecoder::kDecoderCNGnb); - } else if (fs_hz_ == 16000) { - packet->header.payloadType = - decoder_database_->GetRtpPayloadType(NetEqDecoder::kDecoderCNGwb); - } else if (fs_hz_ == 32000) { - packet->header.payloadType = decoder_database_->GetRtpPayloadType( - NetEqDecoder::kDecoderCNGswb32kHz); - } else if (fs_hz_ == 48000) { - packet->header.payloadType = decoder_database_->GetRtpPayloadType( - NetEqDecoder::kDecoderCNGswb48kHz); - } - assert(decoder_database_->IsComfortNoise(packet->header.payloadType)); -#else LOG(LS_ERROR) << "Trying to decode non-CNG payload as CNG."; return kOtherError; -#endif } // UpdateParameters() deletes |packet|. if (comfort_noise_->UpdateParameters(packet) == diff --git a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc index 783c7ff53e..99eb38499b 100644 --- a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc +++ b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc @@ -462,13 +462,13 @@ TEST_F(NetEqDecodingTest, MAYBE_TestBitExactness) { const std::string output_checksum = PlatformChecksum( "472ebe1126f41fdb6b5c63c87f625a52e7604e49", - "d2a6b6ff54b340cf9f961c7f07768d86b3761073", + "36f6fc87c05de077e998173b46b83524de5e8fc2", "472ebe1126f41fdb6b5c63c87f625a52e7604e49", "f9749813dbc3fb59dae761de518fec65b8407c5b"); const std::string network_stats_checksum = PlatformChecksum( "2cf380a05ee07080bd72471e8ec7777a39644ec9", - "01be67dc4c3b8e74743a45cbd8684c0535dec9ad", + "f50795e25ec2bab2d418c694ab088012776fd450", "2cf380a05ee07080bd72471e8ec7777a39644ec9", "2cf380a05ee07080bd72471e8ec7777a39644ec9");