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

Side by Side Diff: webrtc/test/rtcp_packet_parser.h

Issue 2372113005: Replace RTCPUtility RTCPParser with TestRtcpParser (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/call/call_perf_tests.cc ('k') | webrtc/test/rtcp_packet_parser.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) 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 */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 public: 54 public:
55 // Keeps last parsed packet, count number of parsed packets of given type. 55 // Keeps last parsed packet, count number of parsed packets of given type.
56 template <typename TypedRtcpPacket> 56 template <typename TypedRtcpPacket>
57 class PacketCounter : public TypedRtcpPacket { 57 class PacketCounter : public TypedRtcpPacket {
58 public: 58 public:
59 int num_packets() const { return num_packets_; } 59 int num_packets() const { return num_packets_; }
60 void Parse(const rtcp::CommonHeader& header) { 60 void Parse(const rtcp::CommonHeader& header) {
61 if (TypedRtcpPacket::Parse(header)) 61 if (TypedRtcpPacket::Parse(header))
62 ++num_packets_; 62 ++num_packets_;
63 } 63 }
64 void Parse(const rtcp::CommonHeader& header, uint32_t* sender_ssrc) {
65 if (TypedRtcpPacket::Parse(header)) {
66 ++num_packets_;
67 if (*sender_ssrc == 0) // Use first sender ssrc in compound packet.
68 *sender_ssrc = TypedRtcpPacket::sender_ssrc();
69 }
70 }
64 71
65 private: 72 private:
66 int num_packets_ = 0; 73 int num_packets_ = 0;
67 }; 74 };
68 75
69 RtcpPacketParser(); 76 RtcpPacketParser();
70 ~RtcpPacketParser(); 77 ~RtcpPacketParser();
71 78
72 bool Parse(const void* packet, size_t packet_len); 79 bool Parse(const void* packet, size_t packet_len);
73 80
(...skipping 11 matching lines...) Expand all
85 PacketCounter<rtcp::Remb>* remb() { return &remb_; } 92 PacketCounter<rtcp::Remb>* remb() { return &remb_; }
86 PacketCounter<rtcp::Rpsi>* rpsi() { return &rpsi_; } 93 PacketCounter<rtcp::Rpsi>* rpsi() { return &rpsi_; }
87 PacketCounter<rtcp::Sdes>* sdes() { return &sdes_; } 94 PacketCounter<rtcp::Sdes>* sdes() { return &sdes_; }
88 PacketCounter<rtcp::SenderReport>* sender_report() { return &sender_report_; } 95 PacketCounter<rtcp::SenderReport>* sender_report() { return &sender_report_; }
89 PacketCounter<rtcp::Sli>* sli() { return &sli_; } 96 PacketCounter<rtcp::Sli>* sli() { return &sli_; }
90 PacketCounter<rtcp::Tmmbn>* tmmbn() { return &tmmbn_; } 97 PacketCounter<rtcp::Tmmbn>* tmmbn() { return &tmmbn_; }
91 PacketCounter<rtcp::Tmmbr>* tmmbr() { return &tmmbr_; } 98 PacketCounter<rtcp::Tmmbr>* tmmbr() { return &tmmbr_; }
92 PacketCounter<rtcp::TransportFeedback>* transport_feedback() { 99 PacketCounter<rtcp::TransportFeedback>* transport_feedback() {
93 return &transport_feedback_; 100 return &transport_feedback_;
94 } 101 }
102 uint32_t sender_ssrc() const { return sender_ssrc_; }
95 103
96 private: 104 private:
97 PacketCounter<rtcp::App> app_; 105 PacketCounter<rtcp::App> app_;
98 PacketCounter<rtcp::Bye> bye_; 106 PacketCounter<rtcp::Bye> bye_;
99 PacketCounter<rtcp::ExtendedJitterReport> ij_; 107 PacketCounter<rtcp::ExtendedJitterReport> ij_;
100 PacketCounter<rtcp::ExtendedReports> xr_; 108 PacketCounter<rtcp::ExtendedReports> xr_;
101 PacketCounter<rtcp::Fir> fir_; 109 PacketCounter<rtcp::Fir> fir_;
102 PacketCounter<rtcp::Nack> nack_; 110 PacketCounter<rtcp::Nack> nack_;
103 PacketCounter<rtcp::Pli> pli_; 111 PacketCounter<rtcp::Pli> pli_;
104 PacketCounter<rtcp::RapidResyncRequest> rrr_; 112 PacketCounter<rtcp::RapidResyncRequest> rrr_;
105 PacketCounter<rtcp::ReceiverReport> receiver_report_; 113 PacketCounter<rtcp::ReceiverReport> receiver_report_;
106 PacketCounter<rtcp::Remb> remb_; 114 PacketCounter<rtcp::Remb> remb_;
107 PacketCounter<rtcp::Rpsi> rpsi_; 115 PacketCounter<rtcp::Rpsi> rpsi_;
108 PacketCounter<rtcp::Sdes> sdes_; 116 PacketCounter<rtcp::Sdes> sdes_;
109 PacketCounter<rtcp::SenderReport> sender_report_; 117 PacketCounter<rtcp::SenderReport> sender_report_;
110 PacketCounter<rtcp::Sli> sli_; 118 PacketCounter<rtcp::Sli> sli_;
111 PacketCounter<rtcp::Tmmbn> tmmbn_; 119 PacketCounter<rtcp::Tmmbn> tmmbn_;
112 PacketCounter<rtcp::Tmmbr> tmmbr_; 120 PacketCounter<rtcp::Tmmbr> tmmbr_;
113 PacketCounter<rtcp::TransportFeedback> transport_feedback_; 121 PacketCounter<rtcp::TransportFeedback> transport_feedback_;
122 uint32_t sender_ssrc_ = 0;
114 }; 123 };
115 124
116 } // namespace test 125 } // namespace test
117 } // namespace webrtc 126 } // namespace webrtc
118 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ 127 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_
OLDNEW
« no previous file with comments | « webrtc/call/call_perf_tests.cc ('k') | webrtc/test/rtcp_packet_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698