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

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

Powered by Google App Engine
This is Rietveld 408576698