Delete helper to parse rtcp packet into rtp header
The only user of that function is only interested in the type of the first rtcp message in the packet, which can be extracted in a simpler way Bug: None Change-Id: I96aeb8ed66099f94d506aa7d8d0d07378f6c952e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226543 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34515}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
5b088a0949
commit
1ccc5a55e1
@ -130,33 +130,6 @@ bool RtpHeaderParser::RTCP() const {
|
||||
}
|
||||
}
|
||||
|
||||
bool RtpHeaderParser::ParseRtcp(RTPHeader* header) const {
|
||||
RTC_DCHECK(header);
|
||||
|
||||
const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin;
|
||||
if (length < kRtcpMinParseLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint8_t V = _ptrRTPDataBegin[0] >> 6;
|
||||
if (V != kRtcpExpectedVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint8_t PT = _ptrRTPDataBegin[1];
|
||||
const size_t len = (_ptrRTPDataBegin[2] << 8) + _ptrRTPDataBegin[3];
|
||||
const uint8_t* ptr = &_ptrRTPDataBegin[4];
|
||||
|
||||
uint32_t SSRC = ByteReader<uint32_t>::ReadBigEndian(ptr);
|
||||
ptr += 4;
|
||||
|
||||
header->payloadType = PT;
|
||||
header->ssrc = SSRC;
|
||||
header->headerLength = 4 + (len << 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RtpHeaderParser::Parse(RTPHeader* header,
|
||||
const RtpHeaderExtensionMap* ptrExtensionMap,
|
||||
bool header_only) const {
|
||||
|
@ -37,7 +37,6 @@ class RtpHeaderParser {
|
||||
|
||||
ABSL_DEPRECATED("Use IsRtpPacket or IsRtcpPacket")
|
||||
bool RTCP() const;
|
||||
bool ParseRtcp(RTPHeader* header) const;
|
||||
bool Parse(RTPHeader* parsedPacket,
|
||||
const RtpHeaderExtensionMap* ptrExtensionMap = nullptr,
|
||||
bool header_only = false) const;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "modules/rtp_rtcp/source/rtp_util.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_utility.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
#include "rtc_base/format_macros.h"
|
||||
@ -295,7 +294,7 @@ class PcapReader : public RtpFileReaderImpl {
|
||||
mit != packets_by_ssrc_.end(); ++mit) {
|
||||
uint32_t ssrc = mit->first;
|
||||
const std::vector<uint32_t>& packet_indices = mit->second;
|
||||
uint8_t pt = packets_[packet_indices[0]].rtp_header.payloadType;
|
||||
int pt = packets_[packet_indices[0]].payload_type;
|
||||
printf("SSRC: %08x, %" RTC_PRIuS " packets, pt=%d\n", ssrc,
|
||||
packet_indices.size(), pt);
|
||||
}
|
||||
@ -358,7 +357,9 @@ class PcapReader : public RtpFileReaderImpl {
|
||||
uint32_t dest_ip;
|
||||
uint16_t source_port;
|
||||
uint16_t dest_port;
|
||||
RTPHeader rtp_header;
|
||||
// Payload type of the RTP packet,
|
||||
// or RTCP packet type of the first RTCP packet in a compound RTCP packet.
|
||||
int payload_type;
|
||||
int32_t pos_in_file; // Byte offset of payload from start of file.
|
||||
uint32_t payload_length;
|
||||
};
|
||||
@ -434,17 +435,13 @@ class PcapReader : public RtpFileReaderImpl {
|
||||
}
|
||||
TRY_PCAP(Read(read_buffer_, marker.payload_length));
|
||||
|
||||
RtpUtility::RtpHeaderParser rtp_parser(read_buffer_, marker.payload_length);
|
||||
if (IsRtcpPacket(rtc::MakeArrayView(read_buffer_, marker.payload_length))) {
|
||||
rtp_parser.ParseRtcp(&marker.rtp_header);
|
||||
rtc::ArrayView<const uint8_t> packet(read_buffer_, marker.payload_length);
|
||||
if (IsRtcpPacket(packet)) {
|
||||
marker.payload_type = packet[1];
|
||||
packets_.push_back(marker);
|
||||
} else {
|
||||
if (!rtp_parser.Parse(&marker.rtp_header, nullptr)) {
|
||||
RTC_LOG(LS_INFO) << "Not recognized as RTP/RTCP";
|
||||
return kResultSkip;
|
||||
}
|
||||
|
||||
uint32_t ssrc = marker.rtp_header.ssrc;
|
||||
} else if (IsRtpPacket(packet)) {
|
||||
uint32_t ssrc = ParseRtpSsrc(packet);
|
||||
marker.payload_type = ParseRtpPayloadType(packet);
|
||||
if (ssrc_filter.empty() || ssrc_filter.find(ssrc) != ssrc_filter.end()) {
|
||||
packets_by_ssrc_[ssrc].push_back(
|
||||
static_cast<uint32_t>(packets_.size()));
|
||||
@ -452,6 +449,9 @@ class PcapReader : public RtpFileReaderImpl {
|
||||
} else {
|
||||
return kResultSkip;
|
||||
}
|
||||
} else {
|
||||
RTC_LOG(LS_INFO) << "Not recognized as RTP/RTCP";
|
||||
return kResultSkip;
|
||||
}
|
||||
|
||||
return kResultSuccess;
|
||||
|
Reference in New Issue
Block a user