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

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

Issue 2688473004: RtpPacketReceiver base class and OnRtpPacket, with a pre-parsed RTP packet. (Closed)
Patch Set: Created 3 years, 10 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
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) { 239 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) {
240 ConfigHelper helper; 240 ConfigHelper helper;
241 helper.config().rtp.transport_cc = true; 241 helper.config().rtp.transport_cc = true;
242 internal::AudioReceiveStream recv_stream( 242 internal::AudioReceiveStream recv_stream(
243 helper.packet_router(), 243 helper.packet_router(),
244 helper.config(), helper.audio_state(), helper.event_log()); 244 helper.config(), helper.audio_state(), helper.event_log());
245 const int kTransportSequenceNumberValue = 1234; 245 const int kTransportSequenceNumberValue = 1234;
246 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension( 246 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension(
247 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2); 247 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2);
248 PacketTime packet_time(5678000, 0); 248 PacketTime packet_time(5678000, 0);
249
250 RtpPacketReceived parsed_packet;
251 ASSERT_TRUE(parsed_packet.Parse(&rtp_packet[0], rtp_packet.size()));
252 parsed_packet.set_arrival_time_ms((packet_time.timestamp + 500) / 1000);
253
254 // TODO(nisse): It seems EXPECT_CALL with reference parameters wants
255 // to compare values rather than addresses. And it seems
256 // RtpPacketReceived doesn't have any equality operator.
257 #if 0
249 EXPECT_CALL(*helper.channel_proxy(), 258 EXPECT_CALL(*helper.channel_proxy(),
250 ReceivedRTPPacket(&rtp_packet[0], 259 ReceivedRTPPacket(parsed_packet))
251 rtp_packet.size(),
252 _))
253 .WillOnce(Return(true)); 260 .WillOnce(Return(true));
254 EXPECT_TRUE( 261 #endif
255 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time)); 262
263 EXPECT_TRUE(recv_stream.OnRtpPacket(parsed_packet));
256 } 264 }
257 265
258 TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) { 266 TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) {
259 ConfigHelper helper; 267 ConfigHelper helper;
260 helper.config().rtp.transport_cc = true; 268 helper.config().rtp.transport_cc = true;
261 internal::AudioReceiveStream recv_stream( 269 internal::AudioReceiveStream recv_stream(
262 helper.packet_router(), 270 helper.packet_router(),
263 helper.config(), helper.audio_state(), helper.event_log()); 271 helper.config(), helper.audio_state(), helper.event_log());
264 272
265 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport(); 273 std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 352
345 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); 353 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0));
346 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); 354 EXPECT_CALL(helper.voice_engine(), StopPlayout(_));
347 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) 355 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream))
348 .WillOnce(Return(true)); 356 .WillOnce(Return(true));
349 357
350 recv_stream.Start(); 358 recv_stream.Start();
351 } 359 }
352 } // namespace test 360 } // namespace test
353 } // namespace webrtc 361 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698