OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 void SetArbitrarySendCodec() { | 24 void SetArbitrarySendCodec() { |
25 // Just grab the first codec. | 25 // Just grab the first codec. |
26 EXPECT_EQ(0, voe_codec_->GetCodec(0, codec_instance_)); | 26 EXPECT_EQ(0, voe_codec_->GetCodec(0, codec_instance_)); |
27 EXPECT_EQ(0, voe_codec_->SetSendCodec(channel_, codec_instance_)); | 27 EXPECT_EQ(0, voe_codec_->SetSendCodec(channel_, codec_instance_)); |
28 } | 28 } |
29 | 29 |
30 webrtc::CodecInst codec_instance_; | 30 webrtc::CodecInst codec_instance_; |
31 }; | 31 }; |
32 | 32 |
33 static void SetRateIfILBC(webrtc::CodecInst* codec_instance, int packet_size) { | 33 static void SetRateIfILBC(webrtc::CodecInst* codec_instance, int packet_size) { |
34 if (!_stricmp(codec_instance->plname, "ilbc")) { | 34 if (!STR_CASE_CMP(codec_instance->plname, "ilbc")) { |
35 if (packet_size == 160 || packet_size == 320) { | 35 if (packet_size == 160 || packet_size == 320) { |
36 codec_instance->rate = 15200; | 36 codec_instance->rate = 15200; |
37 } else { | 37 } else { |
38 codec_instance->rate = 13300; | 38 codec_instance->rate = 13300; |
39 } | 39 } |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 static bool IsNotViableSendCodec(const char* codec_name) { | 43 static bool IsNotViableSendCodec(const char* codec_name) { |
44 return !_stricmp(codec_name, "CN") || | 44 return !STR_CASE_CMP(codec_name, "CN") || |
45 !_stricmp(codec_name, "telephone-event") || | 45 !STR_CASE_CMP(codec_name, "telephone-event") || |
46 !_stricmp(codec_name, "red"); | 46 !STR_CASE_CMP(codec_name, "red"); |
47 } | 47 } |
48 | 48 |
49 TEST_F(CodecTest, PcmuIsDefaultCodecAndHasTheRightValues) { | 49 TEST_F(CodecTest, PcmuIsDefaultCodecAndHasTheRightValues) { |
50 EXPECT_EQ(0, voe_codec_->GetSendCodec(channel_, codec_instance_)); | 50 EXPECT_EQ(0, voe_codec_->GetSendCodec(channel_, codec_instance_)); |
51 EXPECT_EQ(1u, codec_instance_.channels); | 51 EXPECT_EQ(1u, codec_instance_.channels); |
52 EXPECT_EQ(160, codec_instance_.pacsize); | 52 EXPECT_EQ(160, codec_instance_.pacsize); |
53 EXPECT_EQ(8000, codec_instance_.plfreq); | 53 EXPECT_EQ(8000, codec_instance_.plfreq); |
54 EXPECT_EQ(0, codec_instance_.pltype); | 54 EXPECT_EQ(0, codec_instance_.pltype); |
55 EXPECT_EQ(64000, codec_instance_.rate); | 55 EXPECT_EQ(64000, codec_instance_.rate); |
56 EXPECT_STRCASEEQ("PCMU", codec_instance_.plname); | 56 EXPECT_STRCASEEQ("PCMU", codec_instance_.plname); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 voe_codec_->GetVADStatus(channel_, vad_enabled, vad_mode, dtx_disabled); | 131 voe_codec_->GetVADStatus(channel_, vad_enabled, vad_mode, dtx_disabled); |
132 | 132 |
133 EXPECT_FALSE(vad_enabled); | 133 EXPECT_FALSE(vad_enabled); |
134 EXPECT_TRUE(dtx_disabled); | 134 EXPECT_TRUE(dtx_disabled); |
135 EXPECT_EQ(webrtc::kVadConventional, vad_mode); | 135 EXPECT_EQ(webrtc::kVadConventional, vad_mode); |
136 } | 136 } |
137 | 137 |
138 TEST_F(CodecTest, OpusMaxPlaybackRateCanBeSet) { | 138 TEST_F(CodecTest, OpusMaxPlaybackRateCanBeSet) { |
139 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 139 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
140 voe_codec_->GetCodec(i, codec_instance_); | 140 voe_codec_->GetCodec(i, codec_instance_); |
141 if (_stricmp("opus", codec_instance_.plname)) { | 141 if (STR_CASE_CMP("opus", codec_instance_.plname)) { |
142 continue; | 142 continue; |
143 } | 143 } |
144 voe_codec_->SetSendCodec(channel_, codec_instance_); | 144 voe_codec_->SetSendCodec(channel_, codec_instance_); |
145 // SetOpusMaxPlaybackRate can handle any integer as the bandwidth. Following | 145 // SetOpusMaxPlaybackRate can handle any integer as the bandwidth. Following |
146 // tests some most commonly used numbers. | 146 // tests some most commonly used numbers. |
147 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 48000)); | 147 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 48000)); |
148 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 32000)); | 148 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 32000)); |
149 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 16000)); | 149 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 16000)); |
150 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 8000)); | 150 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 8000)); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 TEST_F(CodecTest, OpusDtxCanBeSetForOpus) { | 154 TEST_F(CodecTest, OpusDtxCanBeSetForOpus) { |
155 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 155 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
156 voe_codec_->GetCodec(i, codec_instance_); | 156 voe_codec_->GetCodec(i, codec_instance_); |
157 if (_stricmp("opus", codec_instance_.plname)) { | 157 if (STR_CASE_CMP("opus", codec_instance_.plname)) { |
158 continue; | 158 continue; |
159 } | 159 } |
160 voe_codec_->SetSendCodec(channel_, codec_instance_); | 160 voe_codec_->SetSendCodec(channel_, codec_instance_); |
161 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, false)); | 161 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, false)); |
162 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, true)); | 162 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, true)); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 TEST_F(CodecTest, OpusDtxCannotBeSetForNonOpus) { | 166 TEST_F(CodecTest, OpusDtxCannotBeSetForNonOpus) { |
167 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 167 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
168 voe_codec_->GetCodec(i, codec_instance_); | 168 voe_codec_->GetCodec(i, codec_instance_); |
169 if (!_stricmp("opus", codec_instance_.plname)) { | 169 if (!STR_CASE_CMP("opus", codec_instance_.plname)) { |
170 continue; | 170 continue; |
171 } | 171 } |
172 voe_codec_->SetSendCodec(channel_, codec_instance_); | 172 voe_codec_->SetSendCodec(channel_, codec_instance_); |
173 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); | 173 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. | 177 // TODO(xians, phoglund): Re-enable when issue 372 is resolved. |
178 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { | 178 TEST_F(CodecTest, DISABLED_ManualVerifySendCodecsForAllPacketSizes) { |
179 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 179 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
(...skipping 24 matching lines...) Expand all Loading... |
204 TEST_LOG("%d ", packet_size); | 204 TEST_LOG("%d ", packet_size); |
205 TEST_LOG_FLUSH; | 205 TEST_LOG_FLUSH; |
206 at_least_one_succeeded = true; | 206 at_least_one_succeeded = true; |
207 Sleep(CODEC_TEST_TIME); | 207 Sleep(CODEC_TEST_TIME); |
208 } | 208 } |
209 } | 209 } |
210 TEST_LOG("\n"); | 210 TEST_LOG("\n"); |
211 EXPECT_TRUE(at_least_one_succeeded); | 211 EXPECT_TRUE(at_least_one_succeeded); |
212 } | 212 } |
213 } | 213 } |
OLD | NEW |