Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: webrtc/audio/audio_receive_stream_unittest.cc

Issue 1535963002: Wire-up BWE feedback for audio receive streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include <string> 11 #include <string>
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 #include "webrtc/audio/audio_receive_stream.h" 15 #include "webrtc/audio/audio_receive_stream.h"
16 #include "webrtc/audio/conversion.h" 16 #include "webrtc/audio/conversion.h"
17 #include "webrtc/call/mock/mock_congestion_controller.h"
18 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h"
19 #include "webrtc/modules/pacing/packet_router.h"
17 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" 20 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
18 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
22 #include "webrtc/modules/utility/include/mock/mock_process_thread.h"
19 #include "webrtc/test/mock_voe_channel_proxy.h" 23 #include "webrtc/test/mock_voe_channel_proxy.h"
20 #include "webrtc/test/mock_voice_engine.h" 24 #include "webrtc/test/mock_voice_engine.h"
25 #include "webrtc/video/call_stats.h"
21 26
22 namespace webrtc { 27 namespace webrtc {
23 namespace test { 28 namespace test {
24 namespace { 29 namespace {
25 30
26 using testing::_; 31 using testing::_;
27 using testing::Return; 32 using testing::Return;
28 33
29 AudioDecodingCallStats MakeAudioDecodeStatsForTest() { 34 AudioDecodingCallStats MakeAudioDecodeStatsForTest() {
30 AudioDecodingCallStats audio_decode_stats; 35 AudioDecodingCallStats audio_decode_stats;
31 audio_decode_stats.calls_to_silence_generator = 234; 36 audio_decode_stats.calls_to_silence_generator = 234;
32 audio_decode_stats.calls_to_neteq = 567; 37 audio_decode_stats.calls_to_neteq = 567;
33 audio_decode_stats.decoded_normal = 890; 38 audio_decode_stats.decoded_normal = 890;
34 audio_decode_stats.decoded_plc = 123; 39 audio_decode_stats.decoded_plc = 123;
35 audio_decode_stats.decoded_cng = 456; 40 audio_decode_stats.decoded_cng = 456;
36 audio_decode_stats.decoded_plc_cng = 789; 41 audio_decode_stats.decoded_plc_cng = 789;
37 return audio_decode_stats; 42 return audio_decode_stats;
38 } 43 }
39 44
40 const int kChannelId = 2; 45 const int kChannelId = 2;
41 const uint32_t kRemoteSsrc = 1234; 46 const uint32_t kRemoteSsrc = 1234;
42 const uint32_t kLocalSsrc = 5678; 47 const uint32_t kLocalSsrc = 5678;
43 const size_t kAbsoluteSendTimeLength = 4; 48 const size_t kOneByteExtensionHeaderLength = 4;
49 const size_t kOneByteExtensionLength = 4;
44 const int kAbsSendTimeId = 2; 50 const int kAbsSendTimeId = 2;
45 const int kAudioLevelId = 3; 51 const int kAudioLevelId = 3;
52 const int kTransportSequenceNumberId = 4;
46 const int kJitterBufferDelay = -7; 53 const int kJitterBufferDelay = -7;
47 const int kPlayoutBufferDelay = 302; 54 const int kPlayoutBufferDelay = 302;
48 const unsigned int kSpeechOutputLevel = 99; 55 const unsigned int kSpeechOutputLevel = 99;
49 const CallStatistics kCallStats = { 56 const CallStatistics kCallStats = {
50 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123}; 57 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123};
51 const CodecInst kCodecInst = { 58 const CodecInst kCodecInst = {
52 123, "codec_name_recv", 96000, -187, -198, -103}; 59 123, "codec_name_recv", 96000, -187, -198, -103};
53 const NetworkStatistics kNetworkStats = { 60 const NetworkStatistics kNetworkStats = {
54 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0}; 61 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0};
55 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest(); 62 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest();
56 63
57 struct ConfigHelper { 64 struct ConfigHelper {
58 ConfigHelper() { 65 ConfigHelper()
66 : call_stats_(Clock::GetRealTimeClock()),
the sun 2016/01/08 10:29:36 Please mock the clock.
stefan-webrtc 2016/01/08 15:36:02 I'll pass in simulated time.
67 congestion_controller_(&process_thread_,
68 &call_stats_,
69 &bitrate_observer_) {
59 using testing::Invoke; 70 using testing::Invoke;
60 71
61 EXPECT_CALL(voice_engine_, 72 EXPECT_CALL(voice_engine_,
62 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 73 RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
63 EXPECT_CALL(voice_engine_, 74 EXPECT_CALL(voice_engine_,
64 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 75 DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
65 AudioState::Config config; 76 AudioState::Config config;
66 config.voice_engine = &voice_engine_; 77 config.voice_engine = &voice_engine_;
67 audio_state_ = AudioState::Create(config); 78 audio_state_ = AudioState::Create(config);
79 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
68 80
69 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) 81 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
70 .WillOnce(Invoke([this](int channel_id) { 82 .WillOnce(Invoke([this](int channel_id) {
71 EXPECT_FALSE(channel_proxy_);
72 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
73 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); 83 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1);
74 EXPECT_CALL(*channel_proxy_, 84 EXPECT_CALL(*channel_proxy_,
75 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) 85 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId))
76 .Times(1); 86 .Times(1);
77 EXPECT_CALL(*channel_proxy_, 87 EXPECT_CALL(*channel_proxy_,
78 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) 88 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId))
79 .Times(1); 89 .Times(1);
80 return channel_proxy_; 90 return channel_proxy_;
81 })); 91 }));
92 EXPECT_CALL(*channel_proxy_,
93 SetCongestionControlObjects(nullptr, nullptr, nullptr))
94 .Times(1);
82 stream_config_.voe_channel_id = kChannelId; 95 stream_config_.voe_channel_id = kChannelId;
83 stream_config_.rtp.local_ssrc = kLocalSsrc; 96 stream_config_.rtp.local_ssrc = kLocalSsrc;
84 stream_config_.rtp.remote_ssrc = kRemoteSsrc; 97 stream_config_.rtp.remote_ssrc = kRemoteSsrc;
85 stream_config_.rtp.extensions.push_back( 98 stream_config_.rtp.extensions.push_back(
86 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 99 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
87 stream_config_.rtp.extensions.push_back( 100 stream_config_.rtp.extensions.push_back(
88 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); 101 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId));
89 } 102 }
90 103
104 MockCongestionController* congestion_controller() {
105 return &congestion_controller_;
106 }
91 MockRemoteBitrateEstimator* remote_bitrate_estimator() { 107 MockRemoteBitrateEstimator* remote_bitrate_estimator() {
92 return &remote_bitrate_estimator_; 108 return &remote_bitrate_estimator_;
93 } 109 }
94 AudioReceiveStream::Config& config() { return stream_config_; } 110 AudioReceiveStream::Config& config() { return stream_config_; }
95 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } 111 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
96 MockVoiceEngine& voice_engine() { return voice_engine_; } 112 MockVoiceEngine& voice_engine() { return voice_engine_; }
97 113
114 void SetupMockForBweFeedback() {
115 EXPECT_CALL(congestion_controller_, GetRemoteBitrateEstimator(true))
116 .WillOnce(Return(&remote_bitrate_estimator_));
117 EXPECT_CALL(congestion_controller_, packet_router())
118 .WillOnce(Return(&packet_router_));
119 EXPECT_CALL(remote_bitrate_estimator_,
120 RemoveStream(stream_config_.rtp.remote_ssrc));
121 ASSERT_TRUE(channel_proxy_);
122 EXPECT_CALL(*channel_proxy_,
123 SetCongestionControlObjects(nullptr, nullptr, &packet_router_))
124 .Times(1);
125 }
126
98 void SetupMockForGetStats() { 127 void SetupMockForGetStats() {
99 using testing::DoAll; 128 using testing::DoAll;
100 using testing::SetArgReferee; 129 using testing::SetArgReferee;
101 130
102 EXPECT_TRUE(channel_proxy_); 131 ASSERT_TRUE(channel_proxy_);
103 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics()) 132 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
104 .WillOnce(Return(kCallStats)); 133 .WillOnce(Return(kCallStats));
105 EXPECT_CALL(*channel_proxy_, GetDelayEstimate()) 134 EXPECT_CALL(*channel_proxy_, GetDelayEstimate())
106 .WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay)); 135 .WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay));
107 EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange()) 136 EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange())
108 .WillOnce(Return(kSpeechOutputLevel)); 137 .WillOnce(Return(kSpeechOutputLevel));
109 EXPECT_CALL(*channel_proxy_, GetNetworkStatistics()) 138 EXPECT_CALL(*channel_proxy_, GetNetworkStatistics())
110 .WillOnce(Return(kNetworkStats)); 139 .WillOnce(Return(kNetworkStats));
111 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics()) 140 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics())
112 .WillOnce(Return(kAudioDecodeStats)); 141 .WillOnce(Return(kAudioDecodeStats));
113 142
114 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _)) 143 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _))
115 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0))); 144 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0)));
116 } 145 }
117 146
118 private: 147 private:
148 CallStats call_stats_;
149 PacketRouter packet_router_;
150 testing::NiceMock<MockBitrateObserver> bitrate_observer_;
151 testing::NiceMock<MockProcessThread> process_thread_;
152 MockCongestionController congestion_controller_;
119 MockRemoteBitrateEstimator remote_bitrate_estimator_; 153 MockRemoteBitrateEstimator remote_bitrate_estimator_;
120 testing::StrictMock<MockVoiceEngine> voice_engine_; 154 testing::StrictMock<MockVoiceEngine> voice_engine_;
121 rtc::scoped_refptr<AudioState> audio_state_; 155 rtc::scoped_refptr<AudioState> audio_state_;
122 AudioReceiveStream::Config stream_config_; 156 AudioReceiveStream::Config stream_config_;
123 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 157 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
124 }; 158 };
125 159
126 void BuildAbsoluteSendTimeExtension(uint8_t* buffer, 160 void BuildOneByteExtension(std::vector<uint8_t>::iterator it,
127 int id, 161 int id,
128 uint32_t abs_send_time) { 162 uint32_t extension_value,
129 const size_t kRtpOneByteHeaderLength = 4; 163 size_t value_length) {
130 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; 164 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE;
131 ByteWriter<uint16_t>::WriteBigEndian(buffer, kRtpOneByteHeaderExtensionId); 165 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kRtpOneByteHeaderExtensionId);
166 it += 2;
132 167
133 const uint32_t kPosLength = 2; 168 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kOneByteExtensionLength / 4);
134 ByteWriter<uint16_t>::WriteBigEndian(buffer + kPosLength, 169 it += 2;
135 kAbsoluteSendTimeLength / 4); 170 const size_t kExtensionDataLength = kOneByteExtensionLength - 1;
136 171 uint32_t shifted_value = extension_value
137 const uint8_t kLengthOfData = 3; 172 << (8 * (kExtensionDataLength - value_length));
138 buffer[kRtpOneByteHeaderLength] = (id << 4) + (kLengthOfData - 1); 173 *it = (id << 4) + (value_length - 1);
139 ByteWriter<uint32_t, kLengthOfData>::WriteBigEndian( 174 ++it;
140 buffer + kRtpOneByteHeaderLength + 1, abs_send_time); 175 ByteWriter<uint32_t, kExtensionDataLength>::WriteBigEndian(&(*it),
176 shifted_value);
141 } 177 }
142 178
143 size_t CreateRtpHeaderWithAbsSendTime(uint8_t* header, 179 std::vector<uint8_t> CreateRtpHeaderWithOneByteExtension(
144 int extension_id, 180 int extension_id,
145 uint32_t abs_send_time) { 181 uint32_t extension_value,
182 size_t value_length) {
183 std::vector<uint8_t> header;
184 header.resize(webrtc::kRtpHeaderSize + kOneByteExtensionHeaderLength +
185 kOneByteExtensionLength);
146 header[0] = 0x80; // Version 2. 186 header[0] = 0x80; // Version 2.
147 header[0] |= 0x10; // Set extension bit. 187 header[0] |= 0x10; // Set extension bit.
148 header[1] = 100; // Payload type. 188 header[1] = 100; // Payload type.
149 header[1] |= 0x80; // Marker bit is set. 189 header[1] |= 0x80; // Marker bit is set.
150 ByteWriter<uint16_t>::WriteBigEndian(header + 2, 0x1234); // Sequence number. 190 ByteWriter<uint16_t>::WriteBigEndian(&header[2], 0x1234); // Sequence number.
151 ByteWriter<uint32_t>::WriteBigEndian(header + 4, 0x5678); // Timestamp. 191 ByteWriter<uint32_t>::WriteBigEndian(&header[4], 0x5678); // Timestamp.
152 ByteWriter<uint32_t>::WriteBigEndian(header + 8, 0x4321); // SSRC. 192 ByteWriter<uint32_t>::WriteBigEndian(&header[8], 0x4321); // SSRC.
153 int32_t rtp_header_length = webrtc::kRtpHeaderSize;
154 193
155 BuildAbsoluteSendTimeExtension(header + rtp_header_length, extension_id, 194 BuildOneByteExtension(header.begin() + webrtc::kRtpHeaderSize, extension_id,
156 abs_send_time); 195 extension_value, value_length);
157 rtp_header_length += kAbsoluteSendTimeLength; 196 return header;
158 return rtp_header_length;
159 } 197 }
160 } // namespace 198 } // namespace
161 199
162 TEST(AudioReceiveStreamTest, ConfigToString) { 200 TEST(AudioReceiveStreamTest, ConfigToString) {
163 AudioReceiveStream::Config config; 201 AudioReceiveStream::Config config;
164 config.rtp.remote_ssrc = kRemoteSsrc; 202 config.rtp.remote_ssrc = kRemoteSsrc;
165 config.rtp.local_ssrc = kLocalSsrc; 203 config.rtp.local_ssrc = kLocalSsrc;
166 config.rtp.extensions.push_back( 204 config.rtp.extensions.push_back(
167 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 205 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
168 config.voe_channel_id = kChannelId; 206 config.voe_channel_id = kChannelId;
169 config.combined_audio_video_bwe = true; 207 config.combined_audio_video_bwe = true;
170 EXPECT_EQ( 208 EXPECT_EQ(
171 "{rtp: {remote_ssrc: 1234, local_ssrc: 5678, extensions: [{name: " 209 "{rtp: {remote_ssrc: 1234, local_ssrc: 5678, extensions: [{name: "
172 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 2}]}, " 210 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 2}]}, "
173 "receive_transport: nullptr, rtcp_send_transport: nullptr, " 211 "receive_transport: nullptr, rtcp_send_transport: nullptr, "
174 "voe_channel_id: 2, combined_audio_video_bwe: true}", 212 "voe_channel_id: 2, combined_audio_video_bwe: true}",
175 config.ToString()); 213 config.ToString());
176 } 214 }
177 215
178 TEST(AudioReceiveStreamTest, ConstructDestruct) { 216 TEST(AudioReceiveStreamTest, ConstructDestruct) {
179 ConfigHelper helper; 217 ConfigHelper helper;
180 internal::AudioReceiveStream recv_stream( 218 internal::AudioReceiveStream recv_stream(
181 helper.remote_bitrate_estimator(), helper.config(), helper.audio_state()); 219 helper.congestion_controller(), helper.config(), helper.audio_state());
220 }
221
222 MATCHER_P(VerifyHeaderExtension, expected_extension, "") {
223 return arg.extension.hasAbsoluteSendTime ==
224 expected_extension.hasAbsoluteSendTime &&
225 arg.extension.absoluteSendTime ==
226 expected_extension.absoluteSendTime &&
227 arg.extension.hasTransportSequenceNumber ==
228 expected_extension.hasTransportSequenceNumber &&
229 arg.extension.transportSequenceNumber ==
230 expected_extension.transportSequenceNumber;
182 } 231 }
183 232
184 TEST(AudioReceiveStreamTest, AudioPacketUpdatesBweWithTimestamp) { 233 TEST(AudioReceiveStreamTest, AudioPacketUpdatesBweWithTimestamp) {
185 ConfigHelper helper; 234 ConfigHelper helper;
186 helper.config().combined_audio_video_bwe = true; 235 helper.config().combined_audio_video_bwe = true;
236 EXPECT_CALL(*helper.congestion_controller(), GetRemoteBitrateEstimator(false))
237 .WillOnce(Return(helper.remote_bitrate_estimator()));
238 EXPECT_CALL(*helper.remote_bitrate_estimator(),
239 RemoveStream(helper.config().rtp.remote_ssrc));
187 internal::AudioReceiveStream recv_stream( 240 internal::AudioReceiveStream recv_stream(
188 helper.remote_bitrate_estimator(), helper.config(), helper.audio_state()); 241 helper.congestion_controller(), helper.config(), helper.audio_state());
189 uint8_t rtp_packet[30];
190 const int kAbsSendTimeValue = 1234; 242 const int kAbsSendTimeValue = 1234;
191 CreateRtpHeaderWithAbsSendTime(rtp_packet, kAbsSendTimeId, kAbsSendTimeValue); 243 std::vector<uint8_t> rtp_packet =
244 CreateRtpHeaderWithOneByteExtension(kAbsSendTimeId, kAbsSendTimeValue, 3);
192 PacketTime packet_time(5678000, 0); 245 PacketTime packet_time(5678000, 0);
193 const size_t kExpectedHeaderLength = 20; 246 const size_t kExpectedHeaderLength = 20;
247 RTPHeaderExtension expected_extension;
248 expected_extension.hasAbsoluteSendTime = true;
249 expected_extension.absoluteSendTime = kAbsSendTimeValue;
194 EXPECT_CALL(*helper.remote_bitrate_estimator(), 250 EXPECT_CALL(*helper.remote_bitrate_estimator(),
195 IncomingPacket(packet_time.timestamp / 1000, 251 IncomingPacket(packet_time.timestamp / 1000,
196 sizeof(rtp_packet) - kExpectedHeaderLength, 252 rtp_packet.size() - kExpectedHeaderLength,
197 testing::_, false)) 253 VerifyHeaderExtension(expected_extension), false))
198 .Times(1); 254 .Times(1);
199 EXPECT_TRUE( 255 EXPECT_TRUE(
200 recv_stream.DeliverRtp(rtp_packet, sizeof(rtp_packet), packet_time)); 256 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time));
257 }
258
259 TEST(AudioReceiveStreamTest, AudioPacketUpdatesBweFeedback) {
260 ConfigHelper helper;
261 helper.config().combined_audio_video_bwe = true;
262 helper.config().rtp.transport_cc = true;
263 helper.config().rtp.extensions.push_back(RtpExtension(
264 RtpExtension::kTransportSequenceNumber, kTransportSequenceNumberId));
265 helper.SetupMockForBweFeedback();
266 internal::AudioReceiveStream recv_stream(
267 helper.congestion_controller(), helper.config(), helper.audio_state());
268 const int kTransportSequenceNumberValue = 1234;
269 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension(
270 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2);
271 PacketTime packet_time(5678000, 0);
272 const size_t kExpectedHeaderLength = 20;
273 RTPHeaderExtension expected_extension;
274 expected_extension.hasTransportSequenceNumber = true;
275 expected_extension.transportSequenceNumber = kTransportSequenceNumberValue;
276 EXPECT_CALL(*helper.remote_bitrate_estimator(),
277 IncomingPacket(packet_time.timestamp / 1000,
278 rtp_packet.size() - kExpectedHeaderLength,
279 VerifyHeaderExtension(expected_extension), false))
280 .Times(1);
281 EXPECT_TRUE(
282 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time));
201 } 283 }
202 284
203 TEST(AudioReceiveStreamTest, GetStats) { 285 TEST(AudioReceiveStreamTest, GetStats) {
204 ConfigHelper helper; 286 ConfigHelper helper;
205 internal::AudioReceiveStream recv_stream( 287 internal::AudioReceiveStream recv_stream(
206 helper.remote_bitrate_estimator(), helper.config(), helper.audio_state()); 288 helper.congestion_controller(), helper.config(), helper.audio_state());
207 helper.SetupMockForGetStats(); 289 helper.SetupMockForGetStats();
208 AudioReceiveStream::Stats stats = recv_stream.GetStats(); 290 AudioReceiveStream::Stats stats = recv_stream.GetStats();
209 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc); 291 EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc);
210 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd); 292 EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd);
211 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived), 293 EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived),
212 stats.packets_rcvd); 294 stats.packets_rcvd);
213 EXPECT_EQ(kCallStats.cumulativeLost, stats.packets_lost); 295 EXPECT_EQ(kCallStats.cumulativeLost, stats.packets_lost);
214 EXPECT_EQ(Q8ToFloat(kCallStats.fractionLost), stats.fraction_lost); 296 EXPECT_EQ(Q8ToFloat(kCallStats.fractionLost), stats.fraction_lost);
215 EXPECT_EQ(std::string(kCodecInst.plname), stats.codec_name); 297 EXPECT_EQ(std::string(kCodecInst.plname), stats.codec_name);
216 EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum); 298 EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum);
(...skipping 19 matching lines...) Expand all
236 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); 318 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq);
237 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); 319 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal);
238 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); 320 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc);
239 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); 321 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng);
240 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); 322 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng);
241 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, 323 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_,
242 stats.capture_start_ntp_time_ms); 324 stats.capture_start_ntp_time_ms);
243 } 325 }
244 } // namespace test 326 } // namespace test
245 } // namespace webrtc 327 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698