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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc

Issue 1985743002: Propagate muted parameter to VoE::Channel (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 virtual void InsertPacket() { 199 virtual void InsertPacket() {
200 const uint8_t kPayload[kPayloadSizeBytes] = {0}; 200 const uint8_t kPayload[kPayloadSizeBytes] = {0};
201 ASSERT_EQ(0, 201 ASSERT_EQ(0,
202 acm_->IncomingPacket(kPayload, kPayloadSizeBytes, rtp_header_)); 202 acm_->IncomingPacket(kPayload, kPayloadSizeBytes, rtp_header_));
203 rtp_utility_->Forward(&rtp_header_); 203 rtp_utility_->Forward(&rtp_header_);
204 } 204 }
205 205
206 virtual void PullAudio() { 206 virtual void PullAudio() {
207 AudioFrame audio_frame; 207 AudioFrame audio_frame;
208 ASSERT_EQ(0, acm_->PlayoutData10Ms(-1, &audio_frame)); 208 bool muted;
209 ASSERT_EQ(0, acm_->PlayoutData10Ms(-1, &audio_frame, &muted));
210 ASSERT_FALSE(muted);
209 } 211 }
210 212
211 virtual void InsertAudio() { 213 virtual void InsertAudio() {
212 ASSERT_GE(acm_->Add10MsData(input_frame_), 0); 214 ASSERT_GE(acm_->Add10MsData(input_frame_), 0);
213 input_frame_.timestamp_ += kNumSamples10ms; 215 input_frame_.timestamp_ += kNumSamples10ms;
214 } 216 }
215 217
216 virtual void VerifyEncoding() { 218 virtual void VerifyEncoding() {
217 int last_length = packet_cb_.last_payload_len_bytes(); 219 int last_length = packet_cb_.last_payload_len_bytes();
218 EXPECT_TRUE(last_length == 2 * codec_.pacsize || last_length == 0) 220 EXPECT_TRUE(last_length == 2 * codec_.pacsize || last_length == 0)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 EXPECT_EQ(0, stats.calls_to_silence_generator); 291 EXPECT_EQ(0, stats.calls_to_silence_generator);
290 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal); 292 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal);
291 EXPECT_EQ(0, stats.decoded_cng); 293 EXPECT_EQ(0, stats.decoded_cng);
292 EXPECT_EQ(kNumPlc, stats.decoded_plc); 294 EXPECT_EQ(kNumPlc, stats.decoded_plc);
293 EXPECT_EQ(kNumPlcCng, stats.decoded_plc_cng); 295 EXPECT_EQ(kNumPlcCng, stats.decoded_plc_cng);
294 } 296 }
295 297
296 TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) { 298 TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) {
297 AudioFrame audio_frame; 299 AudioFrame audio_frame;
298 const int kSampleRateHz = 32000; 300 const int kSampleRateHz = 32000;
299 EXPECT_EQ(0, acm_->PlayoutData10Ms(kSampleRateHz, &audio_frame)); 301 bool muted;
302 EXPECT_EQ(0, acm_->PlayoutData10Ms(kSampleRateHz, &audio_frame, &muted));
303 ASSERT_FALSE(muted);
300 EXPECT_EQ(id_, audio_frame.id_); 304 EXPECT_EQ(id_, audio_frame.id_);
301 EXPECT_EQ(0u, audio_frame.timestamp_); 305 EXPECT_EQ(0u, audio_frame.timestamp_);
302 EXPECT_GT(audio_frame.num_channels_, 0u); 306 EXPECT_GT(audio_frame.num_channels_, 0u);
303 EXPECT_EQ(static_cast<size_t>(kSampleRateHz / 100), 307 EXPECT_EQ(static_cast<size_t>(kSampleRateHz / 100),
304 audio_frame.samples_per_channel_); 308 audio_frame.samples_per_channel_);
305 EXPECT_EQ(kSampleRateHz, audio_frame.sample_rate_hz_); 309 EXPECT_EQ(kSampleRateHz, audio_frame.sample_rate_hz_);
306 } 310 }
307 311
308 TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) { 312 TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) {
309 AudioFrame audio_frame; 313 AudioFrame audio_frame;
310 EXPECT_EQ(-1, acm_->PlayoutData10Ms(0, &audio_frame)); 314 bool muted;
315 EXPECT_EQ(-1, acm_->PlayoutData10Ms(0, &audio_frame, &muted));
311 } 316 }
312 317
313 // Checks that the transport callback is invoked once for each speech packet. 318 // Checks that the transport callback is invoked once for each speech packet.
314 // Also checks that the frame type is kAudioFrameSpeech. 319 // Also checks that the frame type is kAudioFrameSpeech.
315 TEST_F(AudioCodingModuleTestOldApi, TransportCallbackIsInvokedForEachPacket) { 320 TEST_F(AudioCodingModuleTestOldApi, TransportCallbackIsInvokedForEachPacket) {
316 const int k10MsBlocksPerPacket = 3; 321 const int k10MsBlocksPerPacket = 3;
317 codec_.pacsize = k10MsBlocksPerPacket * kSampleRateHz / 100; 322 codec_.pacsize = k10MsBlocksPerPacket * kSampleRateHz / 100;
318 RegisterCodec(); 323 RegisterCodec();
319 const int kLoops = 10; 324 const int kLoops = 10;
320 for (int i = 0; i < kLoops; ++i) { 325 for (int i = 0; i < kLoops; ++i) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 804 }
800 // Now we're not holding the crit sect when calling ACM. 805 // Now we're not holding the crit sect when calling ACM.
801 806
802 // Insert into ACM. 807 // Insert into ACM.
803 EXPECT_EQ(0, acm_->IncomingPacket(encoded.data(), info.encoded_bytes, 808 EXPECT_EQ(0, acm_->IncomingPacket(encoded.data(), info.encoded_bytes,
804 rtp_header_)); 809 rtp_header_));
805 810
806 // Pull audio. 811 // Pull audio.
807 for (int i = 0; i < rtc::CheckedDivExact(kPacketSizeMs, 10); ++i) { 812 for (int i = 0; i < rtc::CheckedDivExact(kPacketSizeMs, 10); ++i) {
808 AudioFrame audio_frame; 813 AudioFrame audio_frame;
814 bool muted;
809 EXPECT_EQ(0, acm_->PlayoutData10Ms(-1 /* default output frequency */, 815 EXPECT_EQ(0, acm_->PlayoutData10Ms(-1 /* default output frequency */,
810 &audio_frame)); 816 &audio_frame, &muted));
817 if (muted) {
818 ADD_FAILURE();
819 return false;
820 }
811 fake_clock_->AdvanceTimeMilliseconds(10); 821 fake_clock_->AdvanceTimeMilliseconds(10);
812 } 822 }
813 rtp_utility_->Forward(&rtp_header_); 823 rtp_utility_->Forward(&rtp_header_);
814 return true; 824 return true;
815 } 825 }
816 826
817 static bool CbCodecRegistrationThread(void* context) { 827 static bool CbCodecRegistrationThread(void* context) {
818 return reinterpret_cast<AcmReRegisterIsacMtTestOldApi*>(context) 828 return reinterpret_cast<AcmReRegisterIsacMtTestOldApi*>(context)
819 ->CbCodecRegistrationImpl(); 829 ->CbCodecRegistrationImpl();
820 } 830 }
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 Run(16000, 8000, 1000); 1789 Run(16000, 8000, 1000);
1780 } 1790 }
1781 1791
1782 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 1792 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
1783 Run(8000, 16000, 1000); 1793 Run(8000, 16000, 1000);
1784 } 1794 }
1785 1795
1786 #endif 1796 #endif
1787 1797
1788 } // namespace webrtc 1798 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698