Allow suppression of padding check in RtpHeaderParser.

Bug: None
Change-Id: I39574cade2c8c9df539f778fd97cb7a62827e169
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125521
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27039}
This commit is contained in:
Sebastian Jansson 2019-03-08 13:45:29 +01:00 committed by Commit Bot
parent 44dd9f29c7
commit 62c7b39c71
3 changed files with 9 additions and 8 deletions

View File

@ -1310,7 +1310,7 @@ void ParsedRtcEventLog::StoreParsedLegacyEvent(const rtclog::Event& event) {
RTPHeader parsed_header; RTPHeader parsed_header;
if (extension_map != nullptr) { if (extension_map != nullptr) {
rtp_parser.Parse(&parsed_header, extension_map); rtp_parser.Parse(&parsed_header, extension_map, true);
} else { } else {
// Use the default extension map. // Use the default extension map.
// TODO(terelius): This should be removed. GetRtpHeader will return the // TODO(terelius): This should be removed. GetRtpHeader will return the
@ -1318,7 +1318,7 @@ void ParsedRtcEventLog::StoreParsedLegacyEvent(const rtclog::Event& event) {
// TODO(ivoc): Once configuration of audio streams is stored in the // TODO(ivoc): Once configuration of audio streams is stored in the
// event log, this can be removed. // event log, this can be removed.
// Tracking bug: webrtc:6399 // Tracking bug: webrtc:6399
rtp_parser.Parse(&parsed_header, &default_extension_map_); rtp_parser.Parse(&parsed_header, &default_extension_map_, true);
} }
// Since we give the parser only a header, there is no way for it to know // Since we give the parser only a header, there is no way for it to know

View File

@ -156,9 +156,9 @@ bool RtpHeaderParser::ParseRtcp(RTPHeader* header) const {
return true; return true;
} }
bool RtpHeaderParser::Parse( bool RtpHeaderParser::Parse(RTPHeader* header,
RTPHeader* header, const RtpHeaderExtensionMap* ptrExtensionMap,
const RtpHeaderExtensionMap* ptrExtensionMap) const { bool header_only) const {
const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin; const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin;
if (length < kRtpMinParseLength) { if (length < kRtpMinParseLength) {
return false; return false;
@ -202,7 +202,7 @@ bool RtpHeaderParser::Parse(
header->timestamp = RTPTimestamp; header->timestamp = RTPTimestamp;
header->ssrc = SSRC; header->ssrc = SSRC;
header->numCSRCs = CC; header->numCSRCs = CC;
if (!P) { if (!P || header_only) {
header->paddingLength = 0; header->paddingLength = 0;
} }
@ -286,7 +286,7 @@ bool RtpHeaderParser::Parse(
if (header->headerLength > static_cast<size_t>(length)) if (header->headerLength > static_cast<size_t>(length))
return false; return false;
if (P) { if (P && !header_only) {
// Packet has padding. // Packet has padding.
if (header->headerLength != static_cast<size_t>(length)) { if (header->headerLength != static_cast<size_t>(length)) {
// Packet is not header only. We can parse padding length now. // Packet is not header only. We can parse padding length now.

View File

@ -37,7 +37,8 @@ class RtpHeaderParser {
bool RTCP() const; bool RTCP() const;
bool ParseRtcp(RTPHeader* header) const; bool ParseRtcp(RTPHeader* header) const;
bool Parse(RTPHeader* parsedPacket, bool Parse(RTPHeader* parsedPacket,
const RtpHeaderExtensionMap* ptrExtensionMap = nullptr) const; const RtpHeaderExtensionMap* ptrExtensionMap = nullptr,
bool header_only = false) const;
private: private:
void ParseOneByteExtensionHeader(RTPHeader* parsedPacket, void ParseOneByteExtensionHeader(RTPHeader* parsedPacket,