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

Side by Side Diff: webrtc/modules/audio_device/audio_device_unittest.cc

Issue 3009093002: Fixes issue in ADM on Mac OSX when audio is renegotiated
Patch Set: nit Created 3 years, 3 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
« no previous file with comments | « no previous file | webrtc/modules/audio_device/mac/audio_device_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 // Tests Start/Stop recording without any registered audio callback. 568 // Tests Start/Stop recording without any registered audio callback.
569 TEST_F(AudioDeviceTest, StartStopRecording) { 569 TEST_F(AudioDeviceTest, StartStopRecording) {
570 SKIP_TEST_IF_NOT(requirements_satisfied()); 570 SKIP_TEST_IF_NOT(requirements_satisfied());
571 StartRecording(); 571 StartRecording();
572 StopRecording(); 572 StopRecording();
573 StartRecording(); 573 StartRecording();
574 StopRecording(); 574 StopRecording();
575 } 575 }
576 576
577 // Tests Init/Stop/Init recording without any registered audio callback.
578 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=8041 for details
579 // on why this test is useful.
580 TEST_F(AudioDeviceTest, InitStopInitRecording) {
581 SKIP_TEST_IF_NOT(requirements_satisfied());
582 EXPECT_EQ(0, audio_device()->InitRecording());
583 EXPECT_TRUE(audio_device()->RecordingIsInitialized());
584 StopRecording();
585 EXPECT_EQ(0, audio_device()->InitRecording());
586 StopRecording();
587 }
588
589 // Tests Init/Stop/Init recording while playout is active.
590 TEST_F(AudioDeviceTest, InitStopInitRecordingWhilePlaying) {
591 SKIP_TEST_IF_NOT(requirements_satisfied());
592 StartPlayout();
593 EXPECT_EQ(0, audio_device()->InitRecording());
594 EXPECT_TRUE(audio_device()->RecordingIsInitialized());
595 StopRecording();
596 EXPECT_EQ(0, audio_device()->InitRecording());
597 StopRecording();
598 StopPlayout();
599 }
600
601 // Tests Init/Stop/Init playout without any registered audio callback.
602 TEST_F(AudioDeviceTest, InitStopInitPlayout) {
603 SKIP_TEST_IF_NOT(requirements_satisfied());
604 EXPECT_EQ(0, audio_device()->InitPlayout());
605 EXPECT_TRUE(audio_device()->PlayoutIsInitialized());
606 StopPlayout();
607 EXPECT_EQ(0, audio_device()->InitPlayout());
608 StopPlayout();
609 }
610
611 // Tests Init/Stop/Init playout while recording is active.
612 TEST_F(AudioDeviceTest, InitStopInitPlayoutWhileRecording) {
613 SKIP_TEST_IF_NOT(requirements_satisfied());
614 StartRecording();
615 EXPECT_EQ(0, audio_device()->InitPlayout());
616 EXPECT_TRUE(audio_device()->PlayoutIsInitialized());
617 StopPlayout();
618 EXPECT_EQ(0, audio_device()->InitPlayout());
619 StopPlayout();
620 StopRecording();
621 }
622
577 // Start playout and verify that the native audio layer starts asking for real 623 // Start playout and verify that the native audio layer starts asking for real
578 // audio samples to play out using the NeedMorePlayData() callback. 624 // audio samples to play out using the NeedMorePlayData() callback.
579 // Note that we can't add expectations on audio parameters in EXPECT_CALL 625 // Note that we can't add expectations on audio parameters in EXPECT_CALL
580 // since parameter are not provided in the each callback. We therefore test and 626 // since parameter are not provided in the each callback. We therefore test and
581 // verify the parameters in the fake audio transport implementation instead. 627 // verify the parameters in the fake audio transport implementation instead.
582 TEST_F(AudioDeviceTest, StartPlayoutVerifyCallbacks) { 628 TEST_F(AudioDeviceTest, StartPlayoutVerifyCallbacks) {
583 SKIP_TEST_IF_NOT(requirements_satisfied()); 629 SKIP_TEST_IF_NOT(requirements_satisfied());
584 MockAudioTransport mock(TransportType::kPlay); 630 MockAudioTransport mock(TransportType::kPlay);
585 mock.HandleCallbacks(event(), nullptr, kNumCallbacks); 631 mock.HandleCallbacks(event(), nullptr, kNumCallbacks);
586 EXPECT_CALL(mock, NeedMorePlayData(_, _, _, _, NotNull(), _, _, _)) 632 EXPECT_CALL(mock, NeedMorePlayData(_, _, _, _, NotNull(), _, _, _))
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 StopPlayout(); 736 StopPlayout();
691 // Verify that the correct number of transmitted impulses are detected. 737 // Verify that the correct number of transmitted impulses are detected.
692 EXPECT_EQ(audio_stream.num_latency_values(), 738 EXPECT_EQ(audio_stream.num_latency_values(),
693 static_cast<size_t>( 739 static_cast<size_t>(
694 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); 740 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1));
695 // Print out min, max and average delay values for debugging purposes. 741 // Print out min, max and average delay values for debugging purposes.
696 audio_stream.PrintResults(); 742 audio_stream.PrintResults();
697 } 743 }
698 744
699 } // namespace webrtc 745 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/mac/audio_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698