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

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

Issue 1853183002: Change NetEq::GetPlayoutTimestamp to return an rtc::Optional<uint32_t> (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 1515
1516 // Pull audio once and verify that the output is speech again. 1516 // Pull audio once and verify that the output is speech again.
1517 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_)); 1517 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_));
1518 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1518 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1519 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1519 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1520 EXPECT_EQ(timestamp + kSamples - algorithmic_delay_samples, 1520 EXPECT_EQ(timestamp + kSamples - algorithmic_delay_samples,
1521 PlayoutTimestamp()); 1521 PlayoutTimestamp());
1522 } 1522 }
1523 1523
1524 uint32_t NetEqDecodingTest::PlayoutTimestamp() { 1524 uint32_t NetEqDecodingTest::PlayoutTimestamp() {
1525 uint32_t playout_timestamp = 0; 1525 rtc::Optional<uint32_t> playout_timestamp = neteq_->GetPlayoutTimestamp();
1526 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(&playout_timestamp)); 1526 EXPECT_TRUE(playout_timestamp);
1527 return playout_timestamp; 1527 return playout_timestamp ? *playout_timestamp : 0;
minyue-webrtc 2016/04/04 15:53:50 consider using value_or()
hlundin-webrtc 2016/04/04 21:02:54 Nice. I didn't know about that one. Done.
1528 } 1528 }
1529 1529
1530 TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { DuplicateCng(); } 1530 TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { DuplicateCng(); }
1531 1531
1532 TEST_F(NetEqDecodingTest, CngFirst) { 1532 TEST_F(NetEqDecodingTest, CngFirst) {
1533 uint16_t seq_no = 0; 1533 uint16_t seq_no = 0;
1534 uint32_t timestamp = 0; 1534 uint32_t timestamp = 0;
1535 const int kFrameSizeMs = 10; 1535 const int kFrameSizeMs = 10;
1536 const int kSampleRateKhz = 16; 1536 const int kSampleRateKhz = 16;
1537 const int kSamples = kFrameSizeMs * kSampleRateKhz; 1537 const int kSamples = kFrameSizeMs * kSampleRateKhz;
(...skipping 25 matching lines...) Expand all
1563 ++seq_no; 1563 ++seq_no;
1564 timestamp += kSamples; 1564 timestamp += kSamples;
1565 1565
1566 // Pull audio once. 1566 // Pull audio once.
1567 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_)); 1567 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_));
1568 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1568 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1569 } 1569 }
1570 // Verify speech output. 1570 // Verify speech output.
1571 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1571 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1572 } 1572 }
1573
1574 } // namespace webrtc 1573 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698