| 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 "webrtc/base/array_view.h" | 15 #include "webrtc/base/array_view.h" |
| 16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" | 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" |
| 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/fir.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" |
| 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
| 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" | |
| 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" |
| 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
| 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" | |
| 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" |
| 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" |
| 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 35 | 33 |
| 36 namespace webrtc { | 34 namespace webrtc { |
| 37 namespace test { | 35 namespace test { |
| 38 // Parse RTCP packet of given type. Assumes RTCP header is valid and that there | 36 // Parse RTCP packet of given type. Assumes RTCP header is valid and that there |
| 39 // is excatly one packet of correct type in the buffer. | 37 // is excatly one packet of correct type in the buffer. |
| 40 template <typename Packet> | 38 template <typename Packet> |
| 41 bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) { | 39 bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 PacketCounter<rtcp::ExtendedJitterReport>* ij() { return &ij_; } | 81 PacketCounter<rtcp::ExtendedJitterReport>* ij() { return &ij_; } |
| 84 PacketCounter<rtcp::ExtendedReports>* xr() { return &xr_; } | 82 PacketCounter<rtcp::ExtendedReports>* xr() { return &xr_; } |
| 85 PacketCounter<rtcp::Fir>* fir() { return &fir_; } | 83 PacketCounter<rtcp::Fir>* fir() { return &fir_; } |
| 86 PacketCounter<rtcp::Nack>* nack() { return &nack_; } | 84 PacketCounter<rtcp::Nack>* nack() { return &nack_; } |
| 87 PacketCounter<rtcp::Pli>* pli() { return &pli_; } | 85 PacketCounter<rtcp::Pli>* pli() { return &pli_; } |
| 88 PacketCounter<rtcp::RapidResyncRequest>* rrr() { return &rrr_; } | 86 PacketCounter<rtcp::RapidResyncRequest>* rrr() { return &rrr_; } |
| 89 PacketCounter<rtcp::ReceiverReport>* receiver_report() { | 87 PacketCounter<rtcp::ReceiverReport>* receiver_report() { |
| 90 return &receiver_report_; | 88 return &receiver_report_; |
| 91 } | 89 } |
| 92 PacketCounter<rtcp::Remb>* remb() { return &remb_; } | 90 PacketCounter<rtcp::Remb>* remb() { return &remb_; } |
| 93 PacketCounter<rtcp::Rpsi>* rpsi() { return &rpsi_; } | |
| 94 PacketCounter<rtcp::Sdes>* sdes() { return &sdes_; } | 91 PacketCounter<rtcp::Sdes>* sdes() { return &sdes_; } |
| 95 PacketCounter<rtcp::SenderReport>* sender_report() { return &sender_report_; } | 92 PacketCounter<rtcp::SenderReport>* sender_report() { return &sender_report_; } |
| 96 PacketCounter<rtcp::Sli>* sli() { return &sli_; } | |
| 97 PacketCounter<rtcp::Tmmbn>* tmmbn() { return &tmmbn_; } | 93 PacketCounter<rtcp::Tmmbn>* tmmbn() { return &tmmbn_; } |
| 98 PacketCounter<rtcp::Tmmbr>* tmmbr() { return &tmmbr_; } | 94 PacketCounter<rtcp::Tmmbr>* tmmbr() { return &tmmbr_; } |
| 99 PacketCounter<rtcp::TransportFeedback>* transport_feedback() { | 95 PacketCounter<rtcp::TransportFeedback>* transport_feedback() { |
| 100 return &transport_feedback_; | 96 return &transport_feedback_; |
| 101 } | 97 } |
| 102 uint32_t sender_ssrc() const { return sender_ssrc_; } | 98 uint32_t sender_ssrc() const { return sender_ssrc_; } |
| 103 | 99 |
| 104 private: | 100 private: |
| 105 PacketCounter<rtcp::App> app_; | 101 PacketCounter<rtcp::App> app_; |
| 106 PacketCounter<rtcp::Bye> bye_; | 102 PacketCounter<rtcp::Bye> bye_; |
| 107 PacketCounter<rtcp::ExtendedJitterReport> ij_; | 103 PacketCounter<rtcp::ExtendedJitterReport> ij_; |
| 108 PacketCounter<rtcp::ExtendedReports> xr_; | 104 PacketCounter<rtcp::ExtendedReports> xr_; |
| 109 PacketCounter<rtcp::Fir> fir_; | 105 PacketCounter<rtcp::Fir> fir_; |
| 110 PacketCounter<rtcp::Nack> nack_; | 106 PacketCounter<rtcp::Nack> nack_; |
| 111 PacketCounter<rtcp::Pli> pli_; | 107 PacketCounter<rtcp::Pli> pli_; |
| 112 PacketCounter<rtcp::RapidResyncRequest> rrr_; | 108 PacketCounter<rtcp::RapidResyncRequest> rrr_; |
| 113 PacketCounter<rtcp::ReceiverReport> receiver_report_; | 109 PacketCounter<rtcp::ReceiverReport> receiver_report_; |
| 114 PacketCounter<rtcp::Remb> remb_; | 110 PacketCounter<rtcp::Remb> remb_; |
| 115 PacketCounter<rtcp::Rpsi> rpsi_; | |
| 116 PacketCounter<rtcp::Sdes> sdes_; | 111 PacketCounter<rtcp::Sdes> sdes_; |
| 117 PacketCounter<rtcp::SenderReport> sender_report_; | 112 PacketCounter<rtcp::SenderReport> sender_report_; |
| 118 PacketCounter<rtcp::Sli> sli_; | |
| 119 PacketCounter<rtcp::Tmmbn> tmmbn_; | 113 PacketCounter<rtcp::Tmmbn> tmmbn_; |
| 120 PacketCounter<rtcp::Tmmbr> tmmbr_; | 114 PacketCounter<rtcp::Tmmbr> tmmbr_; |
| 121 PacketCounter<rtcp::TransportFeedback> transport_feedback_; | 115 PacketCounter<rtcp::TransportFeedback> transport_feedback_; |
| 122 uint32_t sender_ssrc_ = 0; | 116 uint32_t sender_ssrc_ = 0; |
| 123 }; | 117 }; |
| 124 | 118 |
| 125 } // namespace test | 119 } // namespace test |
| 126 } // namespace webrtc | 120 } // namespace webrtc |
| 127 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ | 121 #endif // WEBRTC_TEST_RTCP_PACKET_PARSER_H_ |
| OLD | NEW |