Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 24 #include "webrtc/system_wrappers/include/clock.h" | 24 #include "webrtc/system_wrappers/include/clock.h" |
| 25 #include "webrtc/test/mock_voe_channel_proxy.h" | 25 #include "webrtc/test/mock_voe_channel_proxy.h" |
| 26 #include "webrtc/test/mock_voice_engine.h" | 26 #include "webrtc/test/mock_voice_engine.h" |
| 27 | 27 |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 namespace test { | 29 namespace test { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 using testing::_; | 32 using testing::_; |
| 33 using testing::FloatEq; | |
| 33 using testing::Return; | 34 using testing::Return; |
| 34 using testing::ReturnRef; | 35 using testing::ReturnRef; |
| 35 | 36 |
| 36 AudioDecodingCallStats MakeAudioDecodeStatsForTest() { | 37 AudioDecodingCallStats MakeAudioDecodeStatsForTest() { |
| 37 AudioDecodingCallStats audio_decode_stats; | 38 AudioDecodingCallStats audio_decode_stats; |
| 38 audio_decode_stats.calls_to_silence_generator = 234; | 39 audio_decode_stats.calls_to_silence_generator = 234; |
| 39 audio_decode_stats.calls_to_neteq = 567; | 40 audio_decode_stats.calls_to_neteq = 567; |
| 40 audio_decode_stats.decoded_normal = 890; | 41 audio_decode_stats.decoded_normal = 890; |
| 41 audio_decode_stats.decoded_plc = 123; | 42 audio_decode_stats.decoded_plc = 123; |
| 42 audio_decode_stats.decoded_cng = 456; | 43 audio_decode_stats.decoded_cng = 456; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 .WillOnce(Invoke([this](int channel_id) { | 85 .WillOnce(Invoke([this](int channel_id) { |
| 85 EXPECT_FALSE(channel_proxy_); | 86 EXPECT_FALSE(channel_proxy_); |
| 86 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | 87 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); |
| 87 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); | 88 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); |
| 88 EXPECT_CALL(*channel_proxy_, | 89 EXPECT_CALL(*channel_proxy_, |
| 89 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) | 90 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) |
| 90 .Times(1); | 91 .Times(1); |
| 91 EXPECT_CALL(*channel_proxy_, | 92 EXPECT_CALL(*channel_proxy_, |
| 92 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) | 93 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) |
| 93 .Times(1); | 94 .Times(1); |
| 94 EXPECT_CALL(*channel_proxy_, EnableReceiveTransportSequenceNumber( | |
| 95 kTransportSequenceNumberId)) | |
| 96 .Times(1); | |
| 97 EXPECT_CALL(*channel_proxy_, | 95 EXPECT_CALL(*channel_proxy_, |
| 98 RegisterReceiverCongestionControlObjects(&packet_router_)) | 96 EnableReceiveTransportSequenceNumber(kTransportSequenceNumberId)) |
| 99 .Times(1); | 97 .Times(1); |
| 98 EXPECT_CALL(*channel_proxy_, | |
| 99 RegisterReceiverCongestionControlObjects(&packet_router_)) | |
| 100 .Times(1); | |
|
kwiberg-webrtc
2016/06/16 09:26:53
Ummm... am I missing something, or is this hunk ju
the sun
2016/06/16 14:34:06
Yes, sorry about that.
| |
| 100 EXPECT_CALL(congestion_controller_, packet_router()) | 101 EXPECT_CALL(congestion_controller_, packet_router()) |
| 101 .WillOnce(Return(&packet_router_)); | 102 .WillOnce(Return(&packet_router_)); |
| 102 EXPECT_CALL(*channel_proxy_, ResetCongestionControlObjects()) | 103 EXPECT_CALL(*channel_proxy_, ResetCongestionControlObjects()) |
| 103 .Times(1); | 104 .Times(1); |
| 104 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) | 105 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) |
| 105 .Times(1); | 106 .Times(1); |
| 106 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) | 107 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) |
| 107 .Times(1); | 108 .Times(1); |
| 108 EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory()) | 109 EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory()) |
| 109 .WillOnce(ReturnRef(decoder_factory_)); | 110 .WillOnce(ReturnRef(decoder_factory_)); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 internal::AudioReceiveStream recv_stream( | 295 internal::AudioReceiveStream recv_stream( |
| 295 helper.congestion_controller(), helper.config(), helper.audio_state()); | 296 helper.congestion_controller(), helper.config(), helper.audio_state()); |
| 296 | 297 |
| 297 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport(); | 298 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport(); |
| 298 EXPECT_CALL(*helper.channel_proxy(), | 299 EXPECT_CALL(*helper.channel_proxy(), |
| 299 ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size())) | 300 ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size())) |
| 300 .WillOnce(Return(true)); | 301 .WillOnce(Return(true)); |
| 301 EXPECT_TRUE(recv_stream.DeliverRtcp(&rtcp_packet[0], rtcp_packet.size())); | 302 EXPECT_TRUE(recv_stream.DeliverRtcp(&rtcp_packet[0], rtcp_packet.size())); |
| 302 } | 303 } |
| 303 | 304 |
| 304 | |
| 305 TEST(AudioReceiveStreamTest, GetStats) { | 305 TEST(AudioReceiveStreamTest, GetStats) { |
| 306 ConfigHelper helper; | 306 ConfigHelper helper; |
| 307 internal::AudioReceiveStream recv_stream( | 307 internal::AudioReceiveStream recv_stream( |
| 308 helper.congestion_controller(), helper.config(), helper.audio_state()); | 308 helper.congestion_controller(), helper.config(), helper.audio_state()); |
| 309 helper.SetupMockForGetStats(); | 309 helper.SetupMockForGetStats(); |
| 310 AudioReceiveStream::Stats stats = recv_stream.GetStats(); | 310 AudioReceiveStream::Stats stats = recv_stream.GetStats(); |
| 311 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc); | 311 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc); |
| 312 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd); | 312 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd); |
| 313 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived), | 313 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived), |
| 314 stats.packets_rcvd); | 314 stats.packets_rcvd); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 336 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator, | 336 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator, |
| 337 stats.decoding_calls_to_silence_generator); | 337 stats.decoding_calls_to_silence_generator); |
| 338 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); | 338 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); |
| 339 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); | 339 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); |
| 340 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); | 340 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); |
| 341 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); | 341 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); |
| 342 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); | 342 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); |
| 343 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, | 343 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, |
| 344 stats.capture_start_ntp_time_ms); | 344 stats.capture_start_ntp_time_ms); |
| 345 } | 345 } |
| 346 | |
| 347 TEST(AudioReceiveStreamTest, SetGain) { | |
| 348 ConfigHelper helper; | |
| 349 internal::AudioReceiveStream recv_stream( | |
| 350 helper.congestion_controller(), helper.config(), helper.audio_state()); | |
| 351 EXPECT_CALL(*helper.channel_proxy(), | |
| 352 SetChannelOutputVolumeScaling(FloatEq(0.765f))); | |
| 353 recv_stream.SetGain(0.765f); | |
| 354 } | |
| 346 } // namespace test | 355 } // namespace test |
| 347 } // namespace webrtc | 356 } // namespace webrtc |
| OLD | NEW |