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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 voe_codec_->SetSendCodec(channel_, codec_instance_); | 146 voe_codec_->SetSendCodec(channel_, codec_instance_); |
147 // SetOpusMaxPlaybackRate can handle any integer as the bandwidth. Following | 147 // SetOpusMaxPlaybackRate can handle any integer as the bandwidth. Following |
148 // tests some most commonly used numbers. | 148 // tests some most commonly used numbers. |
149 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 48000)); | 149 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 48000)); |
150 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 32000)); | 150 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 32000)); |
151 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 16000)); | 151 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 16000)); |
152 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 8000)); | 152 EXPECT_EQ(0, voe_codec_->SetOpusMaxPlaybackRate(channel_, 8000)); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 TEST_F(CodecTest, OpusMaxPlaybackRateCannotBeSetForNonOpus) { | |
157 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | |
158 voe_codec_->GetCodec(i, codec_instance_); | |
159 if (!_stricmp("opus", codec_instance_.plname)) { | |
160 continue; | |
161 } | |
162 voe_codec_->SetSendCodec(channel_, codec_instance_); | |
163 EXPECT_EQ(-1, voe_codec_->SetOpusMaxPlaybackRate(channel_, 16000)); | |
164 } | |
165 } | |
166 | |
167 TEST_F(CodecTest, OpusDtxCanBeSetForOpus) { | 156 TEST_F(CodecTest, OpusDtxCanBeSetForOpus) { |
168 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 157 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
169 voe_codec_->GetCodec(i, codec_instance_); | 158 voe_codec_->GetCodec(i, codec_instance_); |
170 if (_stricmp("opus", codec_instance_.plname)) { | 159 if (_stricmp("opus", codec_instance_.plname)) { |
171 continue; | 160 continue; |
172 } | 161 } |
173 voe_codec_->SetSendCodec(channel_, codec_instance_); | 162 voe_codec_->SetSendCodec(channel_, codec_instance_); |
174 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, false)); | 163 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, false)); |
175 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, true)); | 164 EXPECT_EQ(0, voe_codec_->SetOpusDtx(channel_, true)); |
176 } | 165 } |
177 } | 166 } |
178 | 167 |
179 TEST_F(CodecTest, OpusDtxCannotBeSetForNonOpus) { | 168 TEST_F(CodecTest, OpusDtxCannotBeSetForNonOpus) { |
180 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { | 169 for (int i = 0; i < voe_codec_->NumOfCodecs(); ++i) { |
181 voe_codec_->GetCodec(i, codec_instance_); | 170 voe_codec_->GetCodec(i, codec_instance_); |
182 if (!_stricmp("opus", codec_instance_.plname)) { | 171 if (!_stricmp("opus", codec_instance_.plname)) { |
183 continue; | 172 continue; |
184 } | 173 } |
185 voe_codec_->SetSendCodec(channel_, codec_instance_); | 174 voe_codec_->SetSendCodec(channel_, codec_instance_); |
186 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, false)); | |
187 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); | 175 EXPECT_EQ(-1, voe_codec_->SetOpusDtx(channel_, true)); |
188 } | 176 } |
189 } | 177 } |
190 | 178 |
191 #ifdef ENABLE_RTC_EVENT_LOG | 179 #ifdef ENABLE_RTC_EVENT_LOG |
192 TEST_F(CodecTest, RtcEventLogIntegrationTest) { | 180 TEST_F(CodecTest, RtcEventLogIntegrationTest) { |
193 webrtc::RtcEventLog* event_log = voe_codec_->GetEventLog(); | 181 webrtc::RtcEventLog* event_log = voe_codec_->GetEventLog(); |
194 ASSERT_TRUE(event_log); | 182 ASSERT_TRUE(event_log); |
195 | 183 |
196 // Find the name of the current test, in order to use it as a temporary | 184 // Find the name of the current test, in order to use it as a temporary |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 TEST_LOG("%d ", packet_size); | 230 TEST_LOG("%d ", packet_size); |
243 TEST_LOG_FLUSH; | 231 TEST_LOG_FLUSH; |
244 at_least_one_succeeded = true; | 232 at_least_one_succeeded = true; |
245 Sleep(CODEC_TEST_TIME); | 233 Sleep(CODEC_TEST_TIME); |
246 } | 234 } |
247 } | 235 } |
248 TEST_LOG("\n"); | 236 TEST_LOG("\n"); |
249 EXPECT_TRUE(at_least_one_succeeded); | 237 EXPECT_TRUE(at_least_one_succeeded); |
250 } | 238 } |
251 } | 239 } |
OLD | NEW |