| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 | 11 |
| 12 #ifndef WEBRTC_TEST_RTCP_PACKET_PARSER_H_ | 12 #ifndef WEBRTC_TEST_RTCP_PACKET_PARSER_H_ |
| 13 #define WEBRTC_TEST_RTCP_PACKET_PARSER_H_ | 13 #define WEBRTC_TEST_RTCP_PACKET_PARSER_H_ |
| 14 | 14 |
| 15 #include <map> | 15 #include <map> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/buffer.h" |
| 20 #include "webrtc/base/checks.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 20 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
| 21 | 24 |
| 22 namespace webrtc { | 25 namespace webrtc { |
| 23 namespace test { | 26 namespace test { |
| 27 // Parse RTCP packet of given type. Assumes RTCP header is valid and that there |
| 28 // is excatly one packet of correct type in the buffer. |
| 29 template <typename Packet> |
| 30 bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) { |
| 31 rtcp::CommonHeader header; |
| 32 RTC_CHECK(header.Parse(buffer, size)); |
| 33 RTC_CHECK_EQ(static_cast<ptrdiff_t>(size), header.NextPacket() - buffer); |
| 34 return packet->Parse(header); |
| 35 } |
| 36 // Same function, but takes raw buffer as single argument instead of pair. |
| 37 template <size_t N, typename Packet> |
| 38 bool ParseSinglePacket(const uint8_t(&buffer)[N], Packet* packet) { |
| 39 return ParseSinglePacket(buffer, N, packet); |
| 40 } |
| 41 template <typename Packet> |
| 42 bool ParseSinglePacket(const rtc::Buffer& buffer, Packet* packet) { |
| 43 return ParseSinglePacket(buffer.data(), buffer.size(), packet); |
| 44 } |
| 24 | 45 |
| 25 class RtcpPacketParser; | 46 class RtcpPacketParser; |
| 26 | 47 |
| 27 class PacketType { | 48 class PacketType { |
| 28 public: | 49 public: |
| 29 virtual ~PacketType() {} | 50 virtual ~PacketType() {} |
| 30 | 51 |
| 31 int num_packets() const { return num_packets_; } | 52 int num_packets() const { return num_packets_; } |
| 32 | 53 |
| 33 protected: | 54 protected: |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 Rrtr rrtr_; | 717 Rrtr rrtr_; |
| 697 Dlrr dlrr_; | 718 Dlrr dlrr_; |
| 698 DlrrItems dlrr_items_; | 719 DlrrItems dlrr_items_; |
| 699 VoipMetric voip_metric_; | 720 VoipMetric voip_metric_; |
| 700 | 721 |
| 701 std::map<uint32_t, int> report_blocks_per_ssrc_; | 722 std::map<uint32_t, int> report_blocks_per_ssrc_; |
| 702 }; | 723 }; |
| 703 } // namespace test | 724 } // namespace test |
| 704 } // namespace webrtc | 725 } // namespace webrtc |
| 705 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ | 726 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ |
| OLD | NEW |