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 |
| 11 #include <memory> |
| 12 |
11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "webrtc/base/scoped_ptr.h" | |
13 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h
" | 14 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer.h
" |
14 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d
efines.h" | 15 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_d
efines.h" |
15 | 16 |
16 namespace webrtc { | 17 namespace webrtc { |
17 | 18 |
18 using testing::_; | 19 using testing::_; |
19 using testing::AtLeast; | 20 using testing::AtLeast; |
20 using testing::Invoke; | 21 using testing::Invoke; |
21 using testing::Return; | 22 using testing::Return; |
22 | 23 |
(...skipping 26 matching lines...) Expand all Loading... |
49 | 50 |
50 TEST(AudioConferenceMixer, AnonymousAndNamed) { | 51 TEST(AudioConferenceMixer, AnonymousAndNamed) { |
51 const int kId = 1; | 52 const int kId = 1; |
52 // Should not matter even if partipants are more than | 53 // Should not matter even if partipants are more than |
53 // kMaximumAmountOfMixedParticipants. | 54 // kMaximumAmountOfMixedParticipants. |
54 const int kNamed = | 55 const int kNamed = |
55 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 1; | 56 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 1; |
56 const int kAnonymous = | 57 const int kAnonymous = |
57 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 1; | 58 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 1; |
58 | 59 |
59 rtc::scoped_ptr<AudioConferenceMixer> mixer( | 60 std::unique_ptr<AudioConferenceMixer> mixer( |
60 AudioConferenceMixer::Create(kId)); | 61 AudioConferenceMixer::Create(kId)); |
61 | 62 |
62 MockMixerParticipant named[kNamed]; | 63 MockMixerParticipant named[kNamed]; |
63 MockMixerParticipant anonymous[kAnonymous]; | 64 MockMixerParticipant anonymous[kAnonymous]; |
64 | 65 |
65 for (int i = 0; i < kNamed; ++i) { | 66 for (int i = 0; i < kNamed; ++i) { |
66 EXPECT_EQ(0, mixer->SetMixabilityStatus(&named[i], true)); | 67 EXPECT_EQ(0, mixer->SetMixabilityStatus(&named[i], true)); |
67 EXPECT_TRUE(mixer->MixabilityStatus(named[i])); | 68 EXPECT_TRUE(mixer->MixabilityStatus(named[i])); |
68 } | 69 } |
69 | 70 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EXPECT_FALSE(mixer->AnonymousMixabilityStatus(anonymous[kAnonymous - 1])); | 102 EXPECT_FALSE(mixer->AnonymousMixabilityStatus(anonymous[kAnonymous - 1])); |
102 EXPECT_FALSE(mixer->MixabilityStatus(anonymous[kAnonymous - 1])); | 103 EXPECT_FALSE(mixer->MixabilityStatus(anonymous[kAnonymous - 1])); |
103 } | 104 } |
104 | 105 |
105 TEST(AudioConferenceMixer, LargestEnergyVadActiveMixed) { | 106 TEST(AudioConferenceMixer, LargestEnergyVadActiveMixed) { |
106 const int kId = 1; | 107 const int kId = 1; |
107 const int kParticipants = | 108 const int kParticipants = |
108 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 3; | 109 AudioConferenceMixer::kMaximumAmountOfMixedParticipants + 3; |
109 const int kSampleRateHz = 32000; | 110 const int kSampleRateHz = 32000; |
110 | 111 |
111 rtc::scoped_ptr<AudioConferenceMixer> mixer( | 112 std::unique_ptr<AudioConferenceMixer> mixer( |
112 AudioConferenceMixer::Create(kId)); | 113 AudioConferenceMixer::Create(kId)); |
113 | 114 |
114 MockAudioMixerOutputReceiver output_receiver; | 115 MockAudioMixerOutputReceiver output_receiver; |
115 EXPECT_EQ(0, mixer->RegisterMixedStreamCallback(&output_receiver)); | 116 EXPECT_EQ(0, mixer->RegisterMixedStreamCallback(&output_receiver)); |
116 | 117 |
117 MockMixerParticipant participants[kParticipants]; | 118 MockMixerParticipant participants[kParticipants]; |
118 | 119 |
119 for (int i = 0; i < kParticipants; ++i) { | 120 for (int i = 0; i < kParticipants; ++i) { |
120 participants[i].fake_frame()->id_ = i; | 121 participants[i].fake_frame()->id_ = i; |
121 participants[i].fake_frame()->sample_rate_hz_ = kSampleRateHz; | 122 participants[i].fake_frame()->sample_rate_hz_ = kSampleRateHz; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } else { | 157 } else { |
157 EXPECT_TRUE(is_mixed) << "Mixing status of Participant #" | 158 EXPECT_TRUE(is_mixed) << "Mixing status of Participant #" |
158 << i << " wrong."; | 159 << i << " wrong."; |
159 } | 160 } |
160 } | 161 } |
161 | 162 |
162 EXPECT_EQ(0, mixer->UnRegisterMixedStreamCallback()); | 163 EXPECT_EQ(0, mixer->UnRegisterMixedStreamCallback()); |
163 } | 164 } |
164 | 165 |
165 } // namespace webrtc | 166 } // namespace webrtc |
OLD | NEW |