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 29 matching lines...) Expand all Loading... |
40 const int kEchoDelayMedian = 254; | 40 const int kEchoDelayMedian = 254; |
41 const int kEchoDelayStdDev = -3; | 41 const int kEchoDelayStdDev = -3; |
42 const int kEchoReturnLoss = -65; | 42 const int kEchoReturnLoss = -65; |
43 const int kEchoReturnLossEnhancement = 101; | 43 const int kEchoReturnLossEnhancement = 101; |
44 const float kResidualEchoLikelihood = -1.0f; | 44 const float kResidualEchoLikelihood = -1.0f; |
45 const unsigned int kSpeechInputLevel = 96; | 45 const unsigned int kSpeechInputLevel = 96; |
46 const CallStatistics kCallStats = { | 46 const CallStatistics kCallStats = { |
47 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; | 47 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; |
48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; | 48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; |
49 const int kTelephoneEventPayloadType = 123; | 49 const int kTelephoneEventPayloadType = 123; |
| 50 const int kTelephoneEventPayloadFrequency = 65432; |
50 const int kTelephoneEventCode = 45; | 51 const int kTelephoneEventCode = 45; |
51 const int kTelephoneEventDuration = 6789; | 52 const int kTelephoneEventDuration = 6789; |
52 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000}; | 53 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000}; |
53 | 54 |
54 class MockLimitObserver : public BitrateAllocator::LimitObserver { | 55 class MockLimitObserver : public BitrateAllocator::LimitObserver { |
55 public: | 56 public: |
56 MOCK_METHOD2(OnAllocationLimitsChanged, | 57 MOCK_METHOD2(OnAllocationLimitsChanged, |
57 void(uint32_t min_send_bitrate_bps, | 58 void(uint32_t min_send_bitrate_bps, |
58 uint32_t max_padding_bitrate_bps)); | 59 uint32_t max_padding_bitrate_bps)); |
59 }; | 60 }; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Let |GetSendCodec| return -1 for the first time to indicate that no send | 148 // Let |GetSendCodec| return -1 for the first time to indicate that no send |
148 // codec has been set. | 149 // codec has been set. |
149 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) | 150 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) |
150 .WillOnce(Return(-1)); | 151 .WillOnce(Return(-1)); |
151 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); | 152 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); |
152 } | 153 } |
153 | 154 |
154 void SetupMockForSendTelephoneEvent() { | 155 void SetupMockForSendTelephoneEvent() { |
155 EXPECT_TRUE(channel_proxy_); | 156 EXPECT_TRUE(channel_proxy_); |
156 EXPECT_CALL(*channel_proxy_, | 157 EXPECT_CALL(*channel_proxy_, |
157 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType)) | 158 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType, |
| 159 kTelephoneEventPayloadFrequency)) |
158 .WillOnce(Return(true)); | 160 .WillOnce(Return(true)); |
159 EXPECT_CALL(*channel_proxy_, | 161 EXPECT_CALL(*channel_proxy_, |
160 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) | 162 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) |
161 .WillOnce(Return(true)); | 163 .WillOnce(Return(true)); |
162 } | 164 } |
163 | 165 |
164 void SetupMockForGetStats() { | 166 void SetupMockForGetStats() { |
165 using testing::DoAll; | 167 using testing::DoAll; |
166 using testing::SetArgReferee; | 168 using testing::SetArgReferee; |
167 | 169 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 263 } |
262 | 264 |
263 TEST(AudioSendStreamTest, SendTelephoneEvent) { | 265 TEST(AudioSendStreamTest, SendTelephoneEvent) { |
264 ConfigHelper helper; | 266 ConfigHelper helper; |
265 internal::AudioSendStream send_stream( | 267 internal::AudioSendStream send_stream( |
266 helper.config(), helper.audio_state(), helper.worker_queue(), | 268 helper.config(), helper.audio_state(), helper.worker_queue(), |
267 helper.congestion_controller(), helper.bitrate_allocator(), | 269 helper.congestion_controller(), helper.bitrate_allocator(), |
268 helper.event_log()); | 270 helper.event_log()); |
269 helper.SetupMockForSendTelephoneEvent(); | 271 helper.SetupMockForSendTelephoneEvent(); |
270 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, | 272 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, |
271 kTelephoneEventCode, kTelephoneEventDuration)); | 273 kTelephoneEventPayloadFrequency, kTelephoneEventCode, |
| 274 kTelephoneEventDuration)); |
272 } | 275 } |
273 | 276 |
274 TEST(AudioSendStreamTest, SetMuted) { | 277 TEST(AudioSendStreamTest, SetMuted) { |
275 ConfigHelper helper; | 278 ConfigHelper helper; |
276 internal::AudioSendStream send_stream( | 279 internal::AudioSendStream send_stream( |
277 helper.config(), helper.audio_state(), helper.worker_queue(), | 280 helper.config(), helper.audio_state(), helper.worker_queue(), |
278 helper.congestion_controller(), helper.bitrate_allocator(), | 281 helper.congestion_controller(), helper.bitrate_allocator(), |
279 helper.event_log()); | 282 helper.event_log()); |
280 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); | 283 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); |
281 send_stream.SetMuted(true); | 284 send_stream.SetMuted(true); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 389 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
387 .WillOnce(Return(0)); | 390 .WillOnce(Return(0)); |
388 internal::AudioSendStream send_stream( | 391 internal::AudioSendStream send_stream( |
389 stream_config, helper.audio_state(), helper.worker_queue(), | 392 stream_config, helper.audio_state(), helper.worker_queue(), |
390 helper.congestion_controller(), helper.bitrate_allocator(), | 393 helper.congestion_controller(), helper.bitrate_allocator(), |
391 helper.event_log()); | 394 helper.event_log()); |
392 } | 395 } |
393 | 396 |
394 } // namespace test | 397 } // namespace test |
395 } // namespace webrtc | 398 } // namespace webrtc |
OLD | NEW |