Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 2270793003: NetEq: only update current_rtp_payload_type_ when validated (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-fuzz-fix1
Patch Set: Fix review comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 ++seq_no; 1514 ++seq_no;
1515 timestamp += kCngPeriodSamples; 1515 timestamp += kCngPeriodSamples;
1516 1516
1517 // Pull audio once and make sure CNG is played. 1517 // Pull audio once and make sure CNG is played.
1518 bool muted; 1518 bool muted;
1519 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1519 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1520 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1520 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1521 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); 1521 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_);
1522 1522
1523 // Insert some speech packets. 1523 // Insert some speech packets.
1524 for (int i = 0; i < 3; ++i) { 1524 const uint32_t first_speech_timestamp = timestamp;
1525 int timeout_counter = 0;
1526 do {
1527 ASSERT_LT(timeout_counter++, 20) << "Test timed out";
1525 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 1528 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
1526 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1529 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
1527 ++seq_no; 1530 ++seq_no;
1528 timestamp += kSamples; 1531 timestamp += kSamples;
1529 1532
1530 // Pull audio once. 1533 // Pull audio once.
1531 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1534 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1532 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1535 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1533 } 1536 } while (!IsNewerTimestamp(out_frame_.timestamp_, first_speech_timestamp));
1534 // Verify speech output. 1537 // Verify speech output.
1535 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1538 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1536 } 1539 }
1537 1540
1538 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { 1541 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest {
1539 public: 1542 public:
1540 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() { 1543 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() {
1541 config_.enable_muted_state = true; 1544 config_.enable_muted_state = true;
1542 } 1545 }
1543 1546
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 if (muted) { 1782 if (muted) {
1780 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1783 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1781 } else { 1784 } else {
1782 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1785 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1783 } 1786 }
1784 } 1787 }
1785 EXPECT_FALSE(muted); 1788 EXPECT_FALSE(muted);
1786 } 1789 }
1787 1790
1788 } // namespace webrtc 1791 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698