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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_packet.cc

Issue 2801733002: Move rtp header extension length check from Packet::FindExtension to ExtensionT::Parse (Closed)
Patch Set: Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_packet.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
index b66f001bd8b31411a667ed8e397e6843ea83c26b..0c28092d4c68a756eec3f67a4cefc4de8e23ed60 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
@@ -533,27 +533,17 @@ bool Packet::ParseBuffer(const uint8_t* buffer, size_t size) {
return true;
}
-bool Packet::FindExtension(ExtensionType type,
- uint8_t length,
- uint16_t* offset) const {
- RTC_DCHECK(offset);
+rtc::ArrayView<const uint8_t> Packet::FindExtension(ExtensionType type) const {
for (const ExtensionInfo& extension : extension_entries_) {
if (extension.type == type) {
if (extension.length == 0) {
// Extension is registered but not set.
- return false;
+ return nullptr;
}
- if (length != extension.length) {
- LOG(LS_WARNING) << "Length mismatch for extension '" << type
- << "': expected " << static_cast<int>(length)
- << ", received " << static_cast<int>(extension.length);
- return false;
- }
- *offset = extension.offset;
- return true;
+ return rtc::MakeArrayView(data() + extension.offset, extension.length);
}
}
- return false;
+ return nullptr;
}
rtc::ArrayView<uint8_t> Packet::AllocateExtension(ExtensionType type,
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698