/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. *
*/
namespace webrtc { namespace test { // Parse RTCP packet of given type. Assumes RTCP header is valid and that there // is excatly one packet of correct type in the buffer. template <typename Packet> bool ParseSinglePacket(const uint8_t* buffer, size_t size, Packet* packet) {
rtcp::CommonHeader header;
RTC_CHECK(header.Parse(buffer, size));
RTC_CHECK_EQ(size, header.NextPacket() - buffer); return packet->Parse(header);
} // Same function, but takes raw buffer as single argument instead of pair. template <typename Packet> bool ParseSinglePacket(rtc::ArrayView<const uint8_t> buffer, Packet* packet) { return ParseSinglePacket(buffer.data(), buffer.size(), packet);
}
class RtcpPacketParser { public: // Keeps last parsed packet, count number of parsed packets of given type. template <typename TypedRtcpPacket> class PacketCounter : public TypedRtcpPacket { public: int num_packets() const { return num_packets_; } void Parse(const rtcp::CommonHeader& header) { if (TypedRtcpPacket::Parse(header))
++num_packets_;
} bool Parse(const rtcp::CommonHeader& header, uint32_t* sender_ssrc) { constbool result = TypedRtcpPacket::Parse(header); if (result) {
++num_packets_; if (*sender_ssrc == 0) // Use first sender ssrc in compound packet.
*sender_ssrc = TypedRtcpPacket::sender_ssrc();
} return result;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.