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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_, SetNACKStatus(true, 15)).Times(1); | 89 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1); |
89 EXPECT_CALL(*channel_proxy_, | 90 EXPECT_CALL(*channel_proxy_, |
90 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) | 91 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) |
91 .Times(1); | 92 .Times(1); |
92 EXPECT_CALL(*channel_proxy_, | 93 EXPECT_CALL(*channel_proxy_, |
93 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) | 94 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) |
94 .Times(1); | 95 .Times(1); |
95 EXPECT_CALL(*channel_proxy_, EnableReceiveTransportSequenceNumber( | |
96 kTransportSequenceNumberId)) | |
97 .Times(1); | |
98 EXPECT_CALL(*channel_proxy_, | 96 EXPECT_CALL(*channel_proxy_, |
99 RegisterReceiverCongestionControlObjects(&packet_router_)) | 97 EnableReceiveTransportSequenceNumber(kTransportSequenceNumberId)) |
100 .Times(1); | 98 .Times(1); |
| 99 EXPECT_CALL(*channel_proxy_, |
| 100 RegisterReceiverCongestionControlObjects(&packet_router_)) |
| 101 .Times(1); |
101 EXPECT_CALL(congestion_controller_, packet_router()) | 102 EXPECT_CALL(congestion_controller_, packet_router()) |
102 .WillOnce(Return(&packet_router_)); | 103 .WillOnce(Return(&packet_router_)); |
103 EXPECT_CALL(*channel_proxy_, ResetCongestionControlObjects()) | 104 EXPECT_CALL(*channel_proxy_, ResetCongestionControlObjects()) |
104 .Times(1); | 105 .Times(1); |
105 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) | 106 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) |
106 .Times(1); | 107 .Times(1); |
107 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) | 108 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) |
108 .Times(1); | 109 .Times(1); |
109 EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory()) | 110 EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory()) |
110 .WillOnce(ReturnRef(decoder_factory_)); | 111 .WillOnce(ReturnRef(decoder_factory_)); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 internal::AudioReceiveStream recv_stream( | 297 internal::AudioReceiveStream recv_stream( |
297 helper.congestion_controller(), helper.config(), helper.audio_state()); | 298 helper.congestion_controller(), helper.config(), helper.audio_state()); |
298 | 299 |
299 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport(); | 300 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport(); |
300 EXPECT_CALL(*helper.channel_proxy(), | 301 EXPECT_CALL(*helper.channel_proxy(), |
301 ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size())) | 302 ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size())) |
302 .WillOnce(Return(true)); | 303 .WillOnce(Return(true)); |
303 EXPECT_TRUE(recv_stream.DeliverRtcp(&rtcp_packet[0], rtcp_packet.size())); | 304 EXPECT_TRUE(recv_stream.DeliverRtcp(&rtcp_packet[0], rtcp_packet.size())); |
304 } | 305 } |
305 | 306 |
306 | |
307 TEST(AudioReceiveStreamTest, GetStats) { | 307 TEST(AudioReceiveStreamTest, GetStats) { |
308 ConfigHelper helper; | 308 ConfigHelper helper; |
309 internal::AudioReceiveStream recv_stream( | 309 internal::AudioReceiveStream recv_stream( |
310 helper.congestion_controller(), helper.config(), helper.audio_state()); | 310 helper.congestion_controller(), helper.config(), helper.audio_state()); |
311 helper.SetupMockForGetStats(); | 311 helper.SetupMockForGetStats(); |
312 AudioReceiveStream::Stats stats = recv_stream.GetStats(); | 312 AudioReceiveStream::Stats stats = recv_stream.GetStats(); |
313 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc); | 313 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc); |
314 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd); | 314 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd); |
315 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived), | 315 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived), |
316 stats.packets_rcvd); | 316 stats.packets_rcvd); |
(...skipping 21 matching lines...) Expand all Loading... |
338 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator, | 338 EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator, |
339 stats.decoding_calls_to_silence_generator); | 339 stats.decoding_calls_to_silence_generator); |
340 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); | 340 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); |
341 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); | 341 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); |
342 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); | 342 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); |
343 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); | 343 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); |
344 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); | 344 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); |
345 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, | 345 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, |
346 stats.capture_start_ntp_time_ms); | 346 stats.capture_start_ntp_time_ms); |
347 } | 347 } |
| 348 |
| 349 TEST(AudioReceiveStreamTest, SetGain) { |
| 350 ConfigHelper helper; |
| 351 internal::AudioReceiveStream recv_stream( |
| 352 helper.congestion_controller(), helper.config(), helper.audio_state()); |
| 353 EXPECT_CALL(*helper.channel_proxy(), |
| 354 SetChannelOutputVolumeScaling(FloatEq(0.765f))); |
| 355 recv_stream.SetGain(0.765f); |
| 356 } |
348 } // namespace test | 357 } // namespace test |
349 } // namespace webrtc | 358 } // namespace webrtc |
OLD | NEW |