Revert "Remove legacy delay manger field trial and update default config."

This reverts commit 93849d4b2a976b0a46059d6f74d9efd8f12eab92.

Reason for revert: AcmReceiverBitExactnessOldApi tests failing on MacARM64; first failing build https://ci.chromium.org/ui/p/webrtc/builders/ci/MacARM64%20M1%20Release/1038/overview
Example faliure
[ RUN      ] AcmReceiverBitExactnessOldApi.8kHzOutput
...
(rtp_file_reader.cc:165): Failed to read
../../modules/audio_coding/acm2/audio_coding_module_unittest.cc:912: Failure
Expected equality of these values:
  checksum_ref
    Which is: "636efe6d0a148f22c5383f356da3deac"
  checksum_string
    Which is: "6a288942d67e82076b38b17777cdaee4"

Original change's description:
> Remove legacy delay manger field trial and update default config.
>
> Bug: webrtc:10333
> Change-Id: I20e55d8d111d93657d1afe556fe3a325337c074c
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232820
> Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35321}

TBR=ivoc@webrtc.org,jakobi@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I0bd3832aacba8dcd8e836650786cea20b4c083be
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10333
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237441
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Commit-Queue: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35324}
This commit is contained in:
Olga Sharonova
2021-11-08 19:09:28 +00:00
committed by WebRTC LUCI CQ
parent 42a850d250
commit 46814941f2
11 changed files with 294 additions and 145 deletions

View File

@ -1026,37 +1026,22 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
EXPECT_CALL(mock_decoder, PacketDuration(nullptr, 0))
.WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
EXPECT_TRUE(neteq_->RegisterPayloadType(kPayloadType,
SdpAudioFormat("opus", 48000, 2)));
// Pointee(x) verifies that first byte of the payload equals x, this makes it
// possible to verify that the correct payload is fed to Decode().
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(0), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
struct Packet {
int sequence_number_delta;
int timestamp_delta;
AudioDecoder::SpeechType decoder_output_type;
};
std::vector<Packet> packets = {
{0, 0, AudioDecoder::kSpeech},
{1, kPayloadLengthSamples, AudioDecoder::kComfortNoise},
{2, 2 * kPayloadLengthSamples, AudioDecoder::kSpeech},
{1, kPayloadLengthSamples, AudioDecoder::kSpeech}};
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(1), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kComfortNoise),
Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
for (size_t i = 0; i < packets.size(); ++i) {
rtp_header.sequenceNumber += packets[i].sequence_number_delta;
rtp_header.timestamp += packets[i].timestamp_delta;
payload[0] = i;
EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Pointee(x) verifies that first byte of the payload equals x, this makes
// it possible to verify that the correct payload is fed to Decode().
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(i), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(
dummy_output, dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(packets[i].decoder_output_type),
Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
}
// Expect comfort noise to be returned by the decoder.
EXPECT_CALL(mock_decoder,
DecodeInternal(IsNull(), 0, kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
@ -1064,24 +1049,87 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
SetArgPointee<4>(AudioDecoder::kComfortNoise),
Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
std::vector<AudioFrame::SpeechType> expected_output = {
AudioFrame::kNormalSpeech, AudioFrame::kCNG, AudioFrame::kNormalSpeech};
size_t output_index = 0;
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(2), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
int timeout_counter = 0;
while (!packet_buffer_->Empty()) {
ASSERT_LT(timeout_counter++, 20) << "Test timed out";
AudioFrame output;
bool muted;
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
if (output_index + 1 < expected_output.size() &&
output.speech_type_ == expected_output[output_index + 1]) {
++output_index;
EXPECT_TRUE(neteq_->RegisterPayloadType(kPayloadType,
SdpAudioFormat("opus", 48000, 2)));
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz);
AudioFrame output;
AudioFrame::SpeechType expected_type[8] = {
AudioFrame::kNormalSpeech, AudioFrame::kNormalSpeech, AudioFrame::kCNG,
AudioFrame::kCNG, AudioFrame::kCNG, AudioFrame::kCNG,
AudioFrame::kNormalSpeech, AudioFrame::kNormalSpeech};
int expected_timestamp_increment[8] = {
-1, // will not be used.
10 * kSampleRateKhz,
-1,
-1, // timestamp will be empty during CNG mode; indicated by -1 here.
-1,
-1,
50 * kSampleRateKhz,
10 * kSampleRateKhz};
// Insert one packet (decoder will return speech).
EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
bool muted;
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
absl::optional<uint32_t> last_timestamp = neteq_->GetPlayoutTimestamp();
ASSERT_TRUE(last_timestamp);
// Insert second packet (decoder will return CNG).
payload[0] = 1;
rtp_header.sequenceNumber++;
rtp_header.timestamp += kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Lambda for verifying the timestamps.
auto verify_timestamp = [&last_timestamp, &expected_timestamp_increment](
absl::optional<uint32_t> ts, size_t i) {
if (expected_timestamp_increment[i] == -1) {
// Expect to get an empty timestamp value during CNG and PLC.
EXPECT_FALSE(ts) << "i = " << i;
} else {
EXPECT_EQ(output.speech_type_, expected_output[output_index]);
ASSERT_TRUE(ts) << "i = " << i;
EXPECT_EQ(*ts, *last_timestamp + expected_timestamp_increment[i])
<< "i = " << i;
last_timestamp = ts;
}
};
for (size_t i = 1; i < 6; ++i) {
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(expected_type[i - 1], output.speech_type_);
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
SCOPED_TRACE("");
verify_timestamp(neteq_->GetPlayoutTimestamp(), i);
}
// Insert third packet, which leaves a gap from last packet.
payload[0] = 2;
rtp_header.sequenceNumber += 2;
rtp_header.timestamp += 2 * kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
for (size_t i = 6; i < 8; ++i) {
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(expected_type[i - 1], output.speech_type_);
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
SCOPED_TRACE("");
verify_timestamp(neteq_->GetPlayoutTimestamp(), i);
}
// Now check the packet buffer, and make sure it is empty.
EXPECT_TRUE(packet_buffer_->Empty());
EXPECT_CALL(mock_decoder, Die());
}