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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 62 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); |
63 AudioState::Config config; | 63 AudioState::Config config; |
64 config.voice_engine = &voice_engine_; | 64 config.voice_engine = &voice_engine_; |
65 audio_state_ = AudioState::Create(config); | 65 audio_state_ = AudioState::Create(config); |
66 | 66 |
67 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) | 67 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) |
68 .WillOnce(Invoke([this](int channel_id) { | 68 .WillOnce(Invoke([this](int channel_id) { |
69 EXPECT_FALSE(channel_proxy_); | 69 EXPECT_FALSE(channel_proxy_); |
70 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | 70 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); |
71 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); | 71 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); |
| 72 EXPECT_CALL(*channel_proxy_, |
| 73 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) |
| 74 .Times(1); |
| 75 EXPECT_CALL(*channel_proxy_, |
| 76 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) |
| 77 .Times(1); |
72 return channel_proxy_; | 78 return channel_proxy_; |
73 })); | 79 })); |
74 EXPECT_CALL(voice_engine_, | |
75 SetReceiveAbsoluteSenderTimeStatus(kChannelId, true, kAbsSendTimeId)) | |
76 .WillOnce(Return(0)); | |
77 EXPECT_CALL(voice_engine_, | |
78 SetReceiveAudioLevelIndicationStatus(kChannelId, true, kAudioLevelId)) | |
79 .WillOnce(Return(0)); | |
80 stream_config_.voe_channel_id = kChannelId; | 80 stream_config_.voe_channel_id = kChannelId; |
81 stream_config_.rtp.local_ssrc = kLocalSsrc; | 81 stream_config_.rtp.local_ssrc = kLocalSsrc; |
82 stream_config_.rtp.remote_ssrc = kRemoteSsrc; | 82 stream_config_.rtp.remote_ssrc = kRemoteSsrc; |
83 stream_config_.rtp.extensions.push_back( | 83 stream_config_.rtp.extensions.push_back( |
84 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); | 84 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); |
85 stream_config_.rtp.extensions.push_back( | 85 stream_config_.rtp.extensions.push_back( |
86 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); | 86 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); |
87 } | 87 } |
88 | 88 |
89 MockRemoteBitrateEstimator* remote_bitrate_estimator() { | 89 MockRemoteBitrateEstimator* remote_bitrate_estimator() { |
90 return &remote_bitrate_estimator_; | 90 return &remote_bitrate_estimator_; |
91 } | 91 } |
92 AudioReceiveStream::Config& config() { return stream_config_; } | 92 AudioReceiveStream::Config& config() { return stream_config_; } |
93 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } | 93 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } |
94 MockVoiceEngine& voice_engine() { return voice_engine_; } | 94 MockVoiceEngine& voice_engine() { return voice_engine_; } |
95 | 95 |
96 void SetupMockForGetStats() { | 96 void SetupMockForGetStats() { |
97 using testing::DoAll; | 97 using testing::DoAll; |
98 using testing::SetArgPointee; | |
99 using testing::SetArgReferee; | 98 using testing::SetArgReferee; |
100 | 99 |
101 EXPECT_CALL(voice_engine_, GetRTCPStatistics(kChannelId, _)) | 100 EXPECT_TRUE(channel_proxy_); |
102 .WillOnce(DoAll(SetArgReferee<1>(kCallStats), Return(0))); | 101 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics()) |
| 102 .WillOnce(Return(kCallStats)); |
| 103 EXPECT_CALL(*channel_proxy_, GetDelayEstimate()) |
| 104 .WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay)); |
| 105 EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange()) |
| 106 .WillOnce(Return(kSpeechOutputLevel)); |
| 107 EXPECT_CALL(*channel_proxy_, GetNetworkStatistics()) |
| 108 .WillOnce(Return(kNetworkStats)); |
| 109 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics()) |
| 110 .WillOnce(Return(kAudioDecodeStats)); |
| 111 |
103 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _)) | 112 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _)) |
104 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0))); | 113 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0))); |
105 EXPECT_CALL(voice_engine_, GetDelayEstimate(kChannelId, _, _)) | |
106 .WillOnce(DoAll(SetArgPointee<1>(kJitterBufferDelay), | |
107 SetArgPointee<2>(kPlayoutBufferDelay), Return(0))); | |
108 EXPECT_CALL(voice_engine_, | |
109 GetSpeechOutputLevelFullRange(kChannelId, _)).WillOnce( | |
110 DoAll(SetArgReferee<1>(kSpeechOutputLevel), Return(0))); | |
111 EXPECT_CALL(voice_engine_, GetNetworkStatistics(kChannelId, _)) | |
112 .WillOnce(DoAll(SetArgReferee<1>(kNetworkStats), Return(0))); | |
113 EXPECT_CALL(voice_engine_, GetDecodingCallStatistics(kChannelId, _)) | |
114 .WillOnce(DoAll(SetArgPointee<1>(kAudioDecodeStats), Return(0))); | |
115 } | 114 } |
116 | 115 |
117 private: | 116 private: |
118 MockRemoteBitrateEstimator remote_bitrate_estimator_; | 117 MockRemoteBitrateEstimator remote_bitrate_estimator_; |
119 testing::StrictMock<MockVoiceEngine> voice_engine_; | 118 testing::StrictMock<MockVoiceEngine> voice_engine_; |
120 rtc::scoped_refptr<AudioState> audio_state_; | 119 rtc::scoped_refptr<AudioState> audio_state_; |
121 AudioReceiveStream::Config stream_config_; | 120 AudioReceiveStream::Config stream_config_; |
122 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 121 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
123 }; | 122 }; |
124 | 123 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); | 234 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); |
236 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); | 235 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); |
237 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); | 236 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); |
238 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); | 237 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); |
239 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); | 238 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); |
240 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, | 239 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, |
241 stats.capture_start_ntp_time_ms); | 240 stats.capture_start_ntp_time_ms); |
242 } | 241 } |
243 } // namespace test | 242 } // namespace test |
244 } // namespace webrtc | 243 } // namespace webrtc |
OLD | NEW |