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); |
527 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); | 529 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); |
528 record_parameters_ = audio_manager()->GetRecordAudioParameters(); | 530 record_parameters_ = audio_manager()->GetRecordAudioParameters(); |
529 build_info_.reset(new BuildInfo()); | 531 build_info_.reset(new BuildInfo()); |
530 } | 532 } |
531 virtual ~AudioDeviceTest() { | 533 virtual ~AudioDeviceTest() { |
532 EXPECT_EQ(0, audio_device_->Terminate()); | 534 EXPECT_EQ(0, audio_device_->Terminate()); |
| 535 // Restore audio mode back to MODE_NORMAL. |
| 536 audio_manager()->SetCommunicationMode(false); |
533 } | 537 } |
534 | 538 |
535 int playout_sample_rate() const { | 539 int playout_sample_rate() const { |
536 return playout_parameters_.sample_rate(); | 540 return playout_parameters_.sample_rate(); |
537 } | 541 } |
538 int record_sample_rate() const { | 542 int record_sample_rate() const { |
539 return record_parameters_.sample_rate(); | 543 return record_parameters_.sample_rate(); |
540 } | 544 } |
541 size_t playout_channels() const { | 545 size_t playout_channels() const { |
542 return playout_parameters_.channels(); | 546 return playout_parameters_.channels(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 StopPlayout(); | 1060 StopPlayout(); |
1057 StopRecording(); | 1061 StopRecording(); |
1058 // Verify that the correct number of transmitted impulses are detected. | 1062 // Verify that the correct number of transmitted impulses are detected. |
1059 EXPECT_EQ(latency_audio_stream->num_latency_values(), | 1063 EXPECT_EQ(latency_audio_stream->num_latency_values(), |
1060 static_cast<size_t>( | 1064 static_cast<size_t>( |
1061 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); | 1065 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); |
1062 latency_audio_stream->PrintResults(); | 1066 latency_audio_stream->PrintResults(); |
1063 } | 1067 } |
1064 | 1068 |
1065 } // namespace webrtc | 1069 } // namespace webrtc |
OLD | NEW |