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

Side by Side Diff: webrtc/voice_engine/test/auto_test/standard/external_media_test.cc

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #include "webrtc/base/arraysize.h"
11 #include "webrtc/modules/interface/module_common_types.h" 12 #include "webrtc/modules/interface/module_common_types.h"
12 #include "webrtc/voice_engine/include/voe_external_media.h" 13 #include "webrtc/voice_engine/include/voe_external_media.h"
13 #include "webrtc/voice_engine/test/auto_test/fakes/fake_media_process.h" 14 #include "webrtc/voice_engine/test/auto_test/fakes/fake_media_process.h"
14 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" 15 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
15 16
16 class ExternalMediaTest : public AfterStreamingFixture { 17 class ExternalMediaTest : public AfterStreamingFixture {
17 protected: 18 protected:
18 void TestRegisterExternalMedia(int channel, webrtc::ProcessingTypes type) { 19 void TestRegisterExternalMedia(int channel, webrtc::ProcessingTypes type) {
19 FakeMediaProcess fake_media_process; 20 FakeMediaProcess fake_media_process;
20 EXPECT_EQ(0, voe_xmedia_->RegisterExternalMediaProcessing( 21 EXPECT_EQ(0, voe_xmedia_->RegisterExternalMediaProcessing(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Sleep(1000); 75 Sleep(1000);
75 } 76 }
76 77
77 TEST_F(ExternalMediaTest, 78 TEST_F(ExternalMediaTest,
78 ExternalMixingWorks) { 79 ExternalMixingWorks) {
79 webrtc::AudioFrame frame; 80 webrtc::AudioFrame frame;
80 PausePlaying(); 81 PausePlaying();
81 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); 82 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true));
82 ResumePlaying(); 83 ResumePlaying();
83 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, 0, &frame)); 84 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, 0, &frame));
84 EXPECT_LT(0, frame.sample_rate_hz_); 85 EXPECT_GT(frame.sample_rate_hz_, 0);
85 EXPECT_LT(0, frame.samples_per_channel_); 86 EXPECT_GT(frame.samples_per_channel_, 0);
86 PausePlaying(); 87 PausePlaying();
87 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); 88 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false));
88 ResumePlaying(); 89 ResumePlaying();
89 } 90 }
90 91
91 TEST_F(ExternalMediaTest, 92 TEST_F(ExternalMediaTest,
92 ExternalMixingResamplesToDesiredFrequency) { 93 ExternalMixingResamplesToDesiredFrequency) {
93 const int kValidFrequencies[] = {8000, 16000, 22000, 32000, 48000}; 94 const int kValidFrequencies[] = {8000, 16000, 22000, 32000, 48000};
94 webrtc::AudioFrame frame; 95 webrtc::AudioFrame frame;
95 PausePlaying(); 96 PausePlaying();
96 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); 97 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true));
97 ResumePlaying(); 98 ResumePlaying();
98 for (size_t i = 0; i < sizeof(kValidFrequencies) / sizeof(int); i++) { 99 for (size_t i = 0; i < arraysize(kValidFrequencies); i++) {
99 int f = kValidFrequencies[i]; 100 int f = kValidFrequencies[i];
100 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) 101 EXPECT_EQ(0, voe_xmedia_->GetAudioFrame(channel_, f, &frame))
101 << "Resampling succeeds for freq=" << f; 102 << "Resampling succeeds for freq=" << f;
102 EXPECT_EQ(f, frame.sample_rate_hz_); 103 EXPECT_EQ(f, frame.sample_rate_hz_);
103 EXPECT_EQ(f / 100, frame.samples_per_channel_); 104 EXPECT_EQ(f / 100, frame.samples_per_channel_);
104 } 105 }
105 PausePlaying(); 106 PausePlaying();
106 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); 107 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false));
107 ResumePlaying(); 108 ResumePlaying();
108 } 109 }
109 110
110 TEST_F(ExternalMediaTest, 111 TEST_F(ExternalMediaTest,
111 ExternalMixingResamplingToInvalidFrequenciesFails) { 112 ExternalMixingResamplingToInvalidFrequenciesFails) {
112 const int kInvalidFrequencies[] = {-8000, -1}; 113 const int kInvalidFrequencies[] = {-8000, -1};
113 webrtc::AudioFrame frame; 114 webrtc::AudioFrame frame;
114 PausePlaying(); 115 PausePlaying();
115 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true)); 116 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, true));
116 ResumePlaying(); 117 ResumePlaying();
117 for (size_t i = 0; i < sizeof(kInvalidFrequencies) / sizeof(int); i++) { 118 for (size_t i = 0; i < arraysize(kInvalidFrequencies); i++) {
118 int f = kInvalidFrequencies[i]; 119 int f = kInvalidFrequencies[i];
119 EXPECT_EQ(-1, voe_xmedia_->GetAudioFrame(channel_, f, &frame)) 120 EXPECT_EQ(-1, voe_xmedia_->GetAudioFrame(channel_, f, &frame))
120 << "Resampling fails for freq=" << f; 121 << "Resampling fails for freq=" << f;
121 } 122 }
122 PausePlaying(); 123 PausePlaying();
123 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false)); 124 EXPECT_EQ(0, voe_xmedia_->SetExternalMixing(channel_, false));
124 ResumePlaying(); 125 ResumePlaying();
125 } 126 }
OLDNEW
« webrtc/system_wrappers/interface/aligned_array.h ('K') | « webrtc/tools/agc/activity_metric.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698