 Chromium Code Reviews
 Chromium Code Reviews Issue 2997973002:
  Split LogRtpHeader and LogRtcpPacket into separate versions for incoming and outgoing packets.
    
  
    Issue 2997973002:
  Split LogRtpHeader and LogRtcpPacket into separate versions for incoming and outgoing packets. 
  | OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 } | 345 } | 
| 346 | 346 | 
| 347 // Check consistency of the parser. | 347 // Check consistency of the parser. | 
| 348 rtclog::StreamConfig parsed_config = parsed_log.GetAudioSendConfig(index); | 348 rtclog::StreamConfig parsed_config = parsed_log.GetAudioSendConfig(index); | 
| 349 VerifyStreamConfigsAreEqual(config, parsed_config); | 349 VerifyStreamConfigsAreEqual(config, parsed_config); | 
| 350 } | 350 } | 
| 351 | 351 | 
| 352 void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log, | 352 void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log, | 
| 353 size_t index, | 353 size_t index, | 
| 354 PacketDirection direction, | 354 PacketDirection direction, | 
| 355 const rtp::Packet& expected_packet) { | |
| 356 const rtclog::Event& event = parsed_log.events_[index]; | |
| 357 ASSERT_TRUE(IsValidBasicEvent(event)); | |
| 358 ASSERT_EQ(rtclog::Event::RTP_EVENT, event.type()); | |
| 359 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); | |
| 360 ASSERT_TRUE(rtp_packet.has_incoming()); | |
| 361 EXPECT_EQ(direction == kIncomingPacket, rtp_packet.incoming()); | |
| 362 ASSERT_TRUE(rtp_packet.has_packet_length()); | |
| 363 EXPECT_EQ(expected_packet.size(), rtp_packet.packet_length()); | |
| 364 size_t header_size = expected_packet.headers_size(); | |
| 365 ASSERT_TRUE(rtp_packet.has_header()); | |
| 366 ASSERT_EQ(header_size, rtp_packet.header().size()); | |
| 367 EXPECT_EQ(0, std::memcmp(expected_packet.data(), rtp_packet.header().data(), | |
| 368 header_size)); | |
| 369 | |
| 370 // Check consistency of the parser. | |
| 371 PacketDirection parsed_direction; | |
| 372 uint8_t parsed_header[1500]; | |
| 373 size_t parsed_header_size, parsed_total_size; | |
| 374 parsed_log.GetRtpHeader(index, &parsed_direction, parsed_header, | |
| 375 &parsed_header_size, &parsed_total_size); | |
| 376 EXPECT_EQ(direction, parsed_direction); | |
| 377 ASSERT_EQ(header_size, parsed_header_size); | |
| 378 EXPECT_EQ(0, std::memcmp(expected_packet.data(), parsed_header, header_size)); | |
| 
danilchap
2017/09/05 08:47:16
if you want detailed (with byte arrays printed) er
 
terelius
2017/09/07 12:53:55
Done. Also changed the similar comparison above.
 | |
| 379 EXPECT_EQ(expected_packet.size(), parsed_total_size); | |
| 380 } | |
| 381 | |
| 382 void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log, | |
| 383 size_t index, | |
| 384 PacketDirection direction, | |
| 355 const uint8_t* header, | 385 const uint8_t* header, | 
| 356 size_t header_size, | 386 size_t header_size, | 
| 357 size_t total_size) { | 387 size_t total_size) { | 
| 358 const rtclog::Event& event = parsed_log.events_[index]; | 388 const rtclog::Event& event = parsed_log.events_[index]; | 
| 359 ASSERT_TRUE(IsValidBasicEvent(event)); | 389 ASSERT_TRUE(IsValidBasicEvent(event)); | 
| 360 ASSERT_EQ(rtclog::Event::RTP_EVENT, event.type()); | 390 ASSERT_EQ(rtclog::Event::RTP_EVENT, event.type()); | 
| 361 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); | 391 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); | 
| 362 ASSERT_TRUE(rtp_packet.has_incoming()); | 392 ASSERT_TRUE(rtp_packet.has_incoming()); | 
| 363 EXPECT_EQ(direction == kIncomingPacket, rtp_packet.incoming()); | 393 EXPECT_EQ(direction == kIncomingPacket, rtp_packet.incoming()); | 
| 364 ASSERT_TRUE(rtp_packet.has_packet_length()); | 394 ASSERT_TRUE(rtp_packet.has_packet_length()); | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 ASSERT_TRUE(bwe_event.has_id()); | 594 ASSERT_TRUE(bwe_event.has_id()); | 
| 565 EXPECT_EQ(id, bwe_event.id()); | 595 EXPECT_EQ(id, bwe_event.id()); | 
| 566 ASSERT_TRUE(bwe_event.has_result()); | 596 ASSERT_TRUE(bwe_event.has_result()); | 
| 567 EXPECT_EQ(GetProbeResultType(failure_reason), bwe_event.result()); | 597 EXPECT_EQ(GetProbeResultType(failure_reason), bwe_event.result()); | 
| 568 ASSERT_FALSE(bwe_event.has_bitrate_bps()); | 598 ASSERT_FALSE(bwe_event.has_bitrate_bps()); | 
| 569 | 599 | 
| 570 // TODO(philipel): Verify the parser when parsing has been implemented. | 600 // TODO(philipel): Verify the parser when parsing has been implemented. | 
| 571 } | 601 } | 
| 572 | 602 | 
| 573 } // namespace webrtc | 603 } // namespace webrtc | 
| OLD | NEW |