| 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 kTransportSequenceNumberId = 4; | 39 const int kTransportSequenceNumberId = 4; |
| 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 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Let |GetSendCodec| return -1 for the first time to indicate that no send | 147 // Let |GetSendCodec| return -1 for the first time to indicate that no send |
| 147 // codec has been set. | 148 // codec has been set. |
| 148 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) | 149 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) |
| 149 .WillOnce(Return(-1)); | 150 .WillOnce(Return(-1)); |
| 150 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); | 151 EXPECT_CALL(voice_engine_, SetSendCodec(kChannelId, _)).WillOnce(Return(0)); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void SetupMockForSendTelephoneEvent() { | 154 void SetupMockForSendTelephoneEvent() { |
| 154 EXPECT_TRUE(channel_proxy_); | 155 EXPECT_TRUE(channel_proxy_); |
| 155 EXPECT_CALL(*channel_proxy_, | 156 EXPECT_CALL(*channel_proxy_, |
| 156 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType)) | 157 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType, |
| 158 kTelephoneEventPayloadFrequency)) |
| 157 .WillOnce(Return(true)); | 159 .WillOnce(Return(true)); |
| 158 EXPECT_CALL(*channel_proxy_, | 160 EXPECT_CALL(*channel_proxy_, |
| 159 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) | 161 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) |
| 160 .WillOnce(Return(true)); | 162 .WillOnce(Return(true)); |
| 161 } | 163 } |
| 162 | 164 |
| 163 void SetupMockForGetStats() { | 165 void SetupMockForGetStats() { |
| 164 using testing::DoAll; | 166 using testing::DoAll; |
| 165 using testing::SetArgReferee; | 167 using testing::SetArgReferee; |
| 166 | 168 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 238 } |
| 237 | 239 |
| 238 TEST(AudioSendStreamTest, SendTelephoneEvent) { | 240 TEST(AudioSendStreamTest, SendTelephoneEvent) { |
| 239 ConfigHelper helper; | 241 ConfigHelper helper; |
| 240 internal::AudioSendStream send_stream( | 242 internal::AudioSendStream send_stream( |
| 241 helper.config(), helper.audio_state(), helper.worker_queue(), | 243 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 242 helper.congestion_controller(), helper.bitrate_allocator(), | 244 helper.congestion_controller(), helper.bitrate_allocator(), |
| 243 helper.event_log()); | 245 helper.event_log()); |
| 244 helper.SetupMockForSendTelephoneEvent(); | 246 helper.SetupMockForSendTelephoneEvent(); |
| 245 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, | 247 EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType, |
| 246 kTelephoneEventCode, kTelephoneEventDuration)); | 248 kTelephoneEventPayloadFrequency, kTelephoneEventCode, |
| 249 kTelephoneEventDuration)); |
| 247 } | 250 } |
| 248 | 251 |
| 249 TEST(AudioSendStreamTest, SetMuted) { | 252 TEST(AudioSendStreamTest, SetMuted) { |
| 250 ConfigHelper helper; | 253 ConfigHelper helper; |
| 251 internal::AudioSendStream send_stream( | 254 internal::AudioSendStream send_stream( |
| 252 helper.config(), helper.audio_state(), helper.worker_queue(), | 255 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 253 helper.congestion_controller(), helper.bitrate_allocator(), | 256 helper.congestion_controller(), helper.bitrate_allocator(), |
| 254 helper.event_log()); | 257 helper.event_log()); |
| 255 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); | 258 EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true)); |
| 256 send_stream.SetMuted(true); | 259 send_stream.SetMuted(true); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 352 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
| 350 .WillOnce(Return(0)); | 353 .WillOnce(Return(0)); |
| 351 internal::AudioSendStream send_stream( | 354 internal::AudioSendStream send_stream( |
| 352 stream_config, helper.audio_state(), helper.worker_queue(), | 355 stream_config, helper.audio_state(), helper.worker_queue(), |
| 353 helper.congestion_controller(), helper.bitrate_allocator(), | 356 helper.congestion_controller(), helper.bitrate_allocator(), |
| 354 helper.event_log()); | 357 helper.event_log()); |
| 355 } | 358 } |
| 356 | 359 |
| 357 } // namespace test | 360 } // namespace test |
| 358 } // namespace webrtc | 361 } // namespace webrtc |
| OLD | NEW |