OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 AudioDeviceTest() | 517 AudioDeviceTest() |
518 : test_is_done_(EventWrapper::Create()) { | 518 : test_is_done_(EventWrapper::Create()) { |
519 // One-time initialization of JVM and application context. Ensures that we | 519 // One-time initialization of JVM and application context. Ensures that we |
520 // can do calls between C++ and Java. Initializes both Java and OpenSL ES | 520 // can do calls between C++ and Java. Initializes both Java and OpenSL ES |
521 // implementations. | 521 // implementations. |
522 webrtc::audiodevicemodule::EnsureInitialized(); | 522 webrtc::audiodevicemodule::EnsureInitialized(); |
523 // Creates an audio device using a default audio layer. | 523 // Creates an audio device using a default audio layer. |
524 audio_device_ = CreateAudioDevice(AudioDeviceModule::kPlatformDefaultAudio); | 524 audio_device_ = CreateAudioDevice(AudioDeviceModule::kPlatformDefaultAudio); |
525 EXPECT_NE(audio_device_.get(), nullptr); | 525 EXPECT_NE(audio_device_.get(), nullptr); |
526 EXPECT_EQ(0, audio_device_->Init()); | 526 EXPECT_EQ(0, audio_device_->Init()); |
527 // Set audio mode to MODE_IN_COMMUNICATION. | |
528 audio_manager()->SetCommunicationMode(true); | |
529 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); | 527 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); |
530 record_parameters_ = audio_manager()->GetRecordAudioParameters(); | 528 record_parameters_ = audio_manager()->GetRecordAudioParameters(); |
531 build_info_.reset(new BuildInfo()); | 529 build_info_.reset(new BuildInfo()); |
532 } | 530 } |
533 virtual ~AudioDeviceTest() { | 531 virtual ~AudioDeviceTest() { |
534 EXPECT_EQ(0, audio_device_->Terminate()); | 532 EXPECT_EQ(0, audio_device_->Terminate()); |
535 // Restore audio mode back to MODE_NORMAL. | |
536 audio_manager()->SetCommunicationMode(false); | |
537 } | 533 } |
538 | 534 |
539 int playout_sample_rate() const { | 535 int playout_sample_rate() const { |
540 return playout_parameters_.sample_rate(); | 536 return playout_parameters_.sample_rate(); |
541 } | 537 } |
542 int record_sample_rate() const { | 538 int record_sample_rate() const { |
543 return record_parameters_.sample_rate(); | 539 return record_parameters_.sample_rate(); |
544 } | 540 } |
545 size_t playout_channels() const { | 541 size_t playout_channels() const { |
546 return playout_parameters_.channels(); | 542 return playout_parameters_.channels(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 StopPlayout(); | 1056 StopPlayout(); |
1061 StopRecording(); | 1057 StopRecording(); |
1062 // Verify that the correct number of transmitted impulses are detected. | 1058 // Verify that the correct number of transmitted impulses are detected. |
1063 EXPECT_EQ(latency_audio_stream->num_latency_values(), | 1059 EXPECT_EQ(latency_audio_stream->num_latency_values(), |
1064 static_cast<size_t>( | 1060 static_cast<size_t>( |
1065 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); | 1061 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); |
1066 latency_audio_stream->PrintResults(); | 1062 latency_audio_stream->PrintResults(); |
1067 } | 1063 } |
1068 | 1064 |
1069 } // namespace webrtc | 1065 } // namespace webrtc |
OLD | NEW |