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

Unified Diff: media/cast/audio_receiver/audio_decoder_unittest.cc

Issue 149703002: Cast: Refactor Audio Receiver to Clang format (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responding to review Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/audio_receiver/audio_decoder.cc ('k') | media/cast/audio_receiver/audio_receiver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/audio_receiver/audio_decoder_unittest.cc
diff --git a/media/cast/audio_receiver/audio_decoder_unittest.cc b/media/cast/audio_receiver/audio_decoder_unittest.cc
index f01f0efac1bb28bf9155272a7e2c68240f8d8f1d..962217d9f2b462022d938a83e16eb9bd8e0451c5 100644
--- a/media/cast/audio_receiver/audio_decoder_unittest.cc
+++ b/media/cast/audio_receiver/audio_decoder_unittest.cc
@@ -30,10 +30,15 @@ class AudioDecoderTest : public ::testing::Test {
testing_clock_ = new base::SimpleTestTickClock();
testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1234));
task_runner_ = new test::FakeTaskRunner(testing_clock_);
- cast_environment_ = new CastEnvironment(
- scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_,
- task_runner_, task_runner_, task_runner_, task_runner_, task_runner_,
- GetDefaultCastReceiverLoggingConfig());
+ cast_environment_ =
+ new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(),
+ task_runner_,
+ task_runner_,
+ task_runner_,
+ task_runner_,
+ task_runner_,
+ task_runner_,
+ GetDefaultCastReceiverLoggingConfig());
}
virtual ~AudioDecoderTest() {}
@@ -48,6 +53,8 @@ class AudioDecoderTest : public ::testing::Test {
scoped_refptr<test::FakeTaskRunner> task_runner_;
scoped_refptr<CastEnvironment> cast_environment_;
scoped_ptr<AudioDecoder> audio_decoder_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest);
};
TEST_F(AudioDecoderTest, Pcm16MonoNoResampleOnePacket) {
@@ -75,21 +82,17 @@ TEST_F(AudioDecoderTest, Pcm16MonoNoResampleOnePacket) {
PcmAudioFrame audio_frame;
uint32 rtp_timestamp;
- EXPECT_FALSE(audio_decoder_->GetRawAudioFrame(number_of_10ms_blocks,
- desired_frequency,
- &audio_frame,
- &rtp_timestamp));
+ EXPECT_FALSE(audio_decoder_->GetRawAudioFrame(
+ number_of_10ms_blocks, desired_frequency, &audio_frame, &rtp_timestamp));
uint8* payload_data = reinterpret_cast<uint8*>(&payload[0]);
size_t payload_size = payload.size() * sizeof(int16);
- audio_decoder_->IncomingParsedRtpPacket(payload_data,
- payload_size, rtp_header);
+ audio_decoder_->IncomingParsedRtpPacket(
+ payload_data, payload_size, rtp_header);
- EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(number_of_10ms_blocks,
- desired_frequency,
- &audio_frame,
- &rtp_timestamp));
+ EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(
+ number_of_10ms_blocks, desired_frequency, &audio_frame, &rtp_timestamp));
EXPECT_EQ(1, audio_frame.channels);
EXPECT_EQ(16000, audio_frame.frequency);
EXPECT_EQ(640ul, audio_frame.samples.size());
@@ -125,24 +128,22 @@ TEST_F(AudioDecoderTest, Pcm16StereoNoResampleTwoPackets) {
uint8* payload_data = reinterpret_cast<uint8*>(&payload[0]);
size_t payload_size = payload.size() * sizeof(int16);
- audio_decoder_->IncomingParsedRtpPacket(payload_data,
- payload_size, rtp_header);
+ audio_decoder_->IncomingParsedRtpPacket(
+ payload_data, payload_size, rtp_header);
int number_of_10ms_blocks = 2;
int desired_frequency = 16000;
PcmAudioFrame audio_frame;
uint32 rtp_timestamp;
- EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(number_of_10ms_blocks,
- desired_frequency,
- &audio_frame,
- &rtp_timestamp));
+ EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(
+ number_of_10ms_blocks, desired_frequency, &audio_frame, &rtp_timestamp));
EXPECT_EQ(2, audio_frame.channels);
EXPECT_EQ(16000, audio_frame.frequency);
EXPECT_EQ(640ul, audio_frame.samples.size());
// First 10 samples per channel are 0 from NetEq.
for (size_t i = 10 * audio_config.channels; i < audio_frame.samples.size();
- ++i) {
+ ++i) {
EXPECT_EQ(0x3412, audio_frame.samples[i]);
}
@@ -150,13 +151,11 @@ TEST_F(AudioDecoderTest, Pcm16StereoNoResampleTwoPackets) {
rtp_header.webrtc.header.sequenceNumber++;
rtp_header.webrtc.header.timestamp += (audio_config.frequency / 100) * 2 * 2;
- audio_decoder_->IncomingParsedRtpPacket(payload_data,
- payload_size, rtp_header);
+ audio_decoder_->IncomingParsedRtpPacket(
+ payload_data, payload_size, rtp_header);
- EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(number_of_10ms_blocks,
- desired_frequency,
- &audio_frame,
- &rtp_timestamp));
+ EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(
+ number_of_10ms_blocks, desired_frequency, &audio_frame, &rtp_timestamp));
EXPECT_EQ(2, audio_frame.channels);
EXPECT_EQ(16000, audio_frame.frequency);
EXPECT_EQ(640ul, audio_frame.samples.size());
@@ -194,18 +193,16 @@ TEST_F(AudioDecoderTest, Pcm16Resample) {
uint8* payload_data = reinterpret_cast<uint8*>(&payload[0]);
size_t payload_size = payload.size() * sizeof(int16);
- audio_decoder_->IncomingParsedRtpPacket(payload_data,
- payload_size, rtp_header);
+ audio_decoder_->IncomingParsedRtpPacket(
+ payload_data, payload_size, rtp_header);
int number_of_10ms_blocks = 2;
int desired_frequency = 48000;
PcmAudioFrame audio_frame;
uint32 rtp_timestamp;
- EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(number_of_10ms_blocks,
- desired_frequency,
- &audio_frame,
- &rtp_timestamp));
+ EXPECT_TRUE(audio_decoder_->GetRawAudioFrame(
+ number_of_10ms_blocks, desired_frequency, &audio_frame, &rtp_timestamp));
EXPECT_EQ(2, audio_frame.channels);
EXPECT_EQ(48000, audio_frame.frequency);
@@ -213,9 +210,10 @@ TEST_F(AudioDecoderTest, Pcm16Resample) {
int count = 0;
// Resampling makes the variance worse.
for (size_t i = 100 * audio_config.channels; i < audio_frame.samples.size();
- ++i) {
+ ++i) {
EXPECT_NEAR(0x3412, audio_frame.samples[i], 400);
- if (0x3412 == audio_frame.samples[i]) count++;
+ if (0x3412 == audio_frame.samples[i])
+ count++;
}
}
« no previous file with comments | « media/cast/audio_receiver/audio_decoder.cc ('k') | media/cast/audio_receiver/audio_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698