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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 TEST(AudioReceiveStreamTest, ConstructDestruct) { | 243 TEST(AudioReceiveStreamTest, ConstructDestruct) { |
244 ConfigHelper helper; | 244 ConfigHelper helper; |
245 internal::AudioReceiveStream recv_stream( | 245 internal::AudioReceiveStream recv_stream( |
246 helper.packet_router(), | 246 helper.packet_router(), |
247 helper.remote_bitrate_estimator(), | 247 helper.remote_bitrate_estimator(), |
248 helper.config(), helper.audio_state(), helper.event_log()); | 248 helper.config(), helper.audio_state(), helper.event_log()); |
249 } | 249 } |
250 | 250 |
251 MATCHER_P(VerifyHeaderExtension, expected_extension, "") { | |
252 return arg.extension.hasTransportSequenceNumber == | |
253 expected_extension.hasTransportSequenceNumber && | |
254 arg.extension.transportSequenceNumber == | |
255 expected_extension.transportSequenceNumber; | |
256 } | |
257 | |
258 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) { | 251 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) { |
259 ConfigHelper helper; | 252 ConfigHelper helper; |
260 helper.config().rtp.transport_cc = true; | 253 helper.config().rtp.transport_cc = true; |
261 helper.SetupMockForBweFeedback(true); | 254 helper.SetupMockForBweFeedback(true); |
262 internal::AudioReceiveStream recv_stream( | 255 internal::AudioReceiveStream recv_stream( |
263 helper.packet_router(), | 256 helper.packet_router(), |
264 helper.remote_bitrate_estimator(), | 257 helper.remote_bitrate_estimator(), |
265 helper.config(), helper.audio_state(), helper.event_log()); | 258 helper.config(), helper.audio_state(), helper.event_log()); |
266 const int kTransportSequenceNumberValue = 1234; | 259 const int kTransportSequenceNumberValue = 1234; |
267 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension( | 260 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension( |
268 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2); | 261 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2); |
269 PacketTime packet_time(5678000, 0); | 262 PacketTime packet_time(5678000, 0); |
270 const size_t kExpectedHeaderLength = 20; | |
271 RTPHeaderExtension expected_extension; | |
272 expected_extension.hasTransportSequenceNumber = true; | |
273 expected_extension.transportSequenceNumber = kTransportSequenceNumberValue; | |
274 EXPECT_CALL(*helper.remote_bitrate_estimator(), | |
275 IncomingPacket(packet_time.timestamp / 1000, | |
276 rtp_packet.size() - kExpectedHeaderLength, | |
277 VerifyHeaderExtension(expected_extension))) | |
278 .Times(1); | |
279 EXPECT_CALL(*helper.channel_proxy(), | 263 EXPECT_CALL(*helper.channel_proxy(), |
280 ReceivedRTPPacket(&rtp_packet[0], | 264 ReceivedRTPPacket(&rtp_packet[0], |
281 rtp_packet.size(), | 265 rtp_packet.size(), |
282 _)) | 266 _)) |
283 .WillOnce(Return(true)); | 267 .WillOnce(Return(true)); |
284 EXPECT_TRUE( | 268 EXPECT_TRUE( |
285 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time)); | 269 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time)); |
286 } | 270 } |
287 | 271 |
288 TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) { | 272 TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 364 |
381 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); | 365 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); |
382 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); | 366 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); |
383 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) | 367 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) |
384 .WillOnce(Return(true)); | 368 .WillOnce(Return(true)); |
385 | 369 |
386 recv_stream.Start(); | 370 recv_stream.Start(); |
387 } | 371 } |
388 } // namespace test | 372 } // namespace test |
389 } // namespace webrtc | 373 } // namespace webrtc |
OLD | NEW |