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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 EXPECT_EQ(0, audio_device_->Init()); | 500 EXPECT_EQ(0, audio_device_->Init()); |
501 EXPECT_EQ(0, | 501 EXPECT_EQ(0, |
502 audio_device()->GetPlayoutAudioParameters(&playout_parameters_)); | 502 audio_device()->GetPlayoutAudioParameters(&playout_parameters_)); |
503 EXPECT_EQ(0, audio_device()->GetRecordAudioParameters(&record_parameters_)); | 503 EXPECT_EQ(0, audio_device()->GetRecordAudioParameters(&record_parameters_)); |
504 } | 504 } |
505 virtual ~AudioDeviceTest() { | 505 virtual ~AudioDeviceTest() { |
506 EXPECT_EQ(0, audio_device_->Terminate()); | 506 EXPECT_EQ(0, audio_device_->Terminate()); |
507 rtc::LogMessage::LogToDebug(old_sev_); | 507 rtc::LogMessage::LogToDebug(old_sev_); |
508 } | 508 } |
509 | 509 |
510 // TODO(henrika): don't use hardcoded values below. | |
511 int playout_sample_rate() const { return playout_parameters_.sample_rate(); } | 510 int playout_sample_rate() const { return playout_parameters_.sample_rate(); } |
512 int record_sample_rate() const { return record_parameters_.sample_rate(); } | 511 int record_sample_rate() const { return record_parameters_.sample_rate(); } |
513 int playout_channels() const { return playout_parameters_.channels(); } | 512 int playout_channels() const { return playout_parameters_.channels(); } |
514 int record_channels() const { return record_parameters_.channels(); } | 513 int record_channels() const { return record_parameters_.channels(); } |
515 size_t playout_frames_per_10ms_buffer() const { | 514 size_t playout_frames_per_10ms_buffer() const { |
516 return playout_parameters_.frames_per_10ms_buffer(); | 515 return playout_parameters_.frames_per_10ms_buffer(); |
517 } | 516 } |
518 size_t record_frames_per_10ms_buffer() const { | 517 size_t record_frames_per_10ms_buffer() const { |
519 return record_parameters_.frames_per_10ms_buffer(); | 518 return record_parameters_.frames_per_10ms_buffer(); |
520 } | 519 } |
521 | 520 |
522 int total_delay_ms() const { | |
523 // TODO(henrika): improve this part. | |
524 return 100; | |
525 } | |
526 | |
527 rtc::scoped_refptr<AudioDeviceModule> audio_device() const { | 521 rtc::scoped_refptr<AudioDeviceModule> audio_device() const { |
528 return audio_device_; | 522 return audio_device_; |
529 } | 523 } |
530 | 524 |
531 AudioDeviceModuleImpl* audio_device_impl() const { | 525 AudioDeviceModuleImpl* audio_device_impl() const { |
532 return static_cast<AudioDeviceModuleImpl*>(audio_device_.get()); | 526 return static_cast<AudioDeviceModuleImpl*>(audio_device_.get()); |
533 } | 527 } |
534 | 528 |
535 AudioDeviceBuffer* audio_device_buffer() const { | 529 AudioDeviceBuffer* audio_device_buffer() const { |
536 return audio_device_impl()->GetAudioDeviceBuffer(); | 530 return audio_device_impl()->GetAudioDeviceBuffer(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 rtc::LoggingSeverity old_sev_; | 596 rtc::LoggingSeverity old_sev_; |
603 }; | 597 }; |
604 | 598 |
605 TEST_F(AudioDeviceTest, ConstructDestruct) { | 599 TEST_F(AudioDeviceTest, ConstructDestruct) { |
606 // Using the test fixture to create and destruct the audio device module. | 600 // Using the test fixture to create and destruct the audio device module. |
607 } | 601 } |
608 | 602 |
609 TEST_F(AudioDeviceTest, InitTerminate) { | 603 TEST_F(AudioDeviceTest, InitTerminate) { |
610 // Initialization is part of the test fixture. | 604 // Initialization is part of the test fixture. |
611 EXPECT_TRUE(audio_device()->Initialized()); | 605 EXPECT_TRUE(audio_device()->Initialized()); |
612 // webrtc::SleepMs(5 * 1000); | |
613 EXPECT_EQ(0, audio_device()->Terminate()); | 606 EXPECT_EQ(0, audio_device()->Terminate()); |
614 EXPECT_FALSE(audio_device()->Initialized()); | 607 EXPECT_FALSE(audio_device()->Initialized()); |
615 } | 608 } |
616 | 609 |
617 // Tests that playout can be initiated, started and stopped. No audio callback | 610 // Tests that playout can be initiated, started and stopped. No audio callback |
618 // is registered in this test. | 611 // is registered in this test. |
619 TEST_F(AudioDeviceTest, StartStopPlayout) { | 612 TEST_F(AudioDeviceTest, StartStopPlayout) { |
620 StartPlayout(); | 613 StartPlayout(); |
621 StopPlayout(); | 614 StopPlayout(); |
622 StartPlayout(); | 615 StartPlayout(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 StopPlayout(); | 777 StopPlayout(); |
785 StopRecording(); | 778 StopRecording(); |
786 // Verify that the correct number of transmitted impulses are detected. | 779 // Verify that the correct number of transmitted impulses are detected. |
787 EXPECT_EQ(latency_audio_stream->num_latency_values(), | 780 EXPECT_EQ(latency_audio_stream->num_latency_values(), |
788 static_cast<size_t>( | 781 static_cast<size_t>( |
789 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); | 782 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); |
790 latency_audio_stream->PrintResults(); | 783 latency_audio_stream->PrintResults(); |
791 } | 784 } |
792 | 785 |
793 } // namespace webrtc | 786 } // namespace webrtc |
OLD | NEW |