| 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 28 matching lines...) Expand all Loading... |
| 39 const int kEchoDelayMedian = 254; | 39 const int kEchoDelayMedian = 254; |
| 40 const int kEchoDelayStdDev = -3; | 40 const int kEchoDelayStdDev = -3; |
| 41 const int kEchoReturnLoss = -65; | 41 const int kEchoReturnLoss = -65; |
| 42 const int kEchoReturnLossEnhancement = 101; | 42 const int kEchoReturnLossEnhancement = 101; |
| 43 const float kResidualEchoLikelihood = 0.0f; | 43 const float kResidualEchoLikelihood = 0.0f; |
| 44 const unsigned int kSpeechInputLevel = 96; | 44 const unsigned int kSpeechInputLevel = 96; |
| 45 const CallStatistics kCallStats = { | 45 const CallStatistics kCallStats = { |
| 46 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; | 46 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; |
| 47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; | 47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; |
| 48 const int kTelephoneEventPayloadType = 123; | 48 const int kTelephoneEventPayloadType = 123; |
| 49 const int kTelephoneEventPayloadFrequency = 65432; |
| 49 const int kTelephoneEventCode = 45; | 50 const int kTelephoneEventCode = 45; |
| 50 const int kTelephoneEventDuration = 6789; | 51 const int kTelephoneEventDuration = 6789; |
| 51 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000}; | 52 const CodecInst kIsacCodec = {103, "isac", 16000, 320, 1, 32000}; |
| 52 | 53 |
| 53 class MockLimitObserver : public BitrateAllocator::LimitObserver { | 54 class MockLimitObserver : public BitrateAllocator::LimitObserver { |
| 54 public: | 55 public: |
| 55 MOCK_METHOD2(OnAllocationLimitsChanged, | 56 MOCK_METHOD2(OnAllocationLimitsChanged, |
| 56 void(uint32_t min_send_bitrate_bps, | 57 void(uint32_t min_send_bitrate_bps, |
| 57 uint32_t max_padding_bitrate_bps)); | 58 uint32_t max_padding_bitrate_bps)); |
| 58 }; | 59 }; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Let |GetSendCodec| return -1 for the first time to indicate that no send | 146 // Let |GetSendCodec| return -1 for the first time to indicate that no send |
| 146 // codec has been set. | 147 // codec has been set. |
| 147 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) | 148 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) |
| 148 .WillOnce(Return(-1)); | 149 .WillOnce(Return(-1)); |
| 149 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); | 150 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); |
| 150 } | 151 } |
| 151 | 152 |
| 152 void SetupMockForSendTelephoneEvent() { | 153 void SetupMockForSendTelephoneEvent() { |
| 153 EXPECT_TRUE(channel_proxy_); | 154 EXPECT_TRUE(channel_proxy_); |
| 154 EXPECT_CALL(*channel_proxy_, | 155 EXPECT_CALL(*channel_proxy_, |
| 155 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType)) | 156 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType, |
| 157 kTelephoneEventPayloadFrequency)) |
| 156 .WillOnce(Return(true)); | 158 .WillOnce(Return(true)); |
| 157 EXPECT_CALL(*channel_proxy_, | 159 EXPECT_CALL(*channel_proxy_, |
| 158 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) | 160 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) |
| 159 .WillOnce(Return(true)); | 161 .WillOnce(Return(true)); |
| 160 } | 162 } |
| 161 | 163 |
| 162 void SetupMockForGetStats() { | 164 void SetupMockForGetStats() { |
| 163 using testing::DoAll; | 165 using testing::DoAll; |
| 164 using testing::SetArgReferee; | 166 using testing::SetArgReferee; |
| 165 | 167 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 253 } |
| 252 | 254 |
| 253 TEST(AudioSendStreamTest, SendTelephoneEvent) { | 255 TEST(AudioSendStreamTest, SendTelephoneEvent) { |
| 254 ConfigHelper helper; | 256 ConfigHelper helper; |
| 255 internal::AudioSendStream send_stream( | 257 internal::AudioSendStream send_stream( |
| 256 helper.config(), helper.audio_state(), helper.worker_queue(), | 258 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 257 helper.congestion_controller(), helper.bitrate_allocator(), | 259 helper.congestion_controller(), helper.bitrate_allocator(), |
| 258 helper.event_log()); | 260 helper.event_log()); |
| 259 helper.SetupMockForSendTelephoneEvent(); | 261 helper.SetupMockForSendTelephoneEvent(); |
| 260 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, | 262 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, |
| 261 kTelephoneEventCode, kTelephoneEventDuration)); | 263 kTelephoneEventPayloadFrequency, kTelephoneEventCode, |
| 264 kTelephoneEventDuration)); |
| 262 } | 265 } |
| 263 | 266 |
| 264 TEST(AudioSendStreamTest, SetMuted) { | 267 TEST(AudioSendStreamTest, SetMuted) { |
| 265 ConfigHelper helper; | 268 ConfigHelper helper; |
| 266 internal::AudioSendStream send_stream( | 269 internal::AudioSendStream send_stream( |
| 267 helper.config(), helper.audio_state(), helper.worker_queue(), | 270 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 268 helper.congestion_controller(), helper.bitrate_allocator(), | 271 helper.congestion_controller(), helper.bitrate_allocator(), |
| 269 helper.event_log()); | 272 helper.event_log()); |
| 270 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); | 273 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); |
| 271 send_stream.SetMuted(true); | 274 send_stream.SetMuted(true); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 379 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
| 377 .WillOnce(Return(0)); | 380 .WillOnce(Return(0)); |
| 378 internal::AudioSendStream send_stream( | 381 internal::AudioSendStream send_stream( |
| 379 stream_config, helper.audio_state(), helper.worker_queue(), | 382 stream_config, helper.audio_state(), helper.worker_queue(), |
| 380 helper.congestion_controller(), helper.bitrate_allocator(), | 383 helper.congestion_controller(), helper.bitrate_allocator(), |
| 381 helper.event_log()); | 384 helper.event_log()); |
| 382 } | 385 } |
| 383 | 386 |
| 384 } // namespace test | 387 } // namespace test |
| 385 } // namespace webrtc | 388 } // namespace webrtc |
| OLD | NEW |