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

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

Issue 2803623004: Allow rtp::Packet::*RawExtension to take 0 as an extension id (Closed)
Patch Set: +AllocateRawExtension 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 | « no previous file | 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 0c28092d4c68a756eec3f67a4cefc4de8e23ed60..7a7c45d38302ca893324003fbd603ee2b34eb3ae 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
@@ -279,12 +279,16 @@ void Packet::SetCsrcs(const std::vector<uint32_t>& csrcs) {
}
bool Packet::HasRawExtension(int id) const {
+ if (id == ExtensionManager::kInvalidId)
+ return false;
RTC_DCHECK_GE(id, kMinExtensionId);
RTC_DCHECK_LE(id, kMaxExtensionId);
return extension_entries_[id - 1].offset != 0;
}
rtc::ArrayView<const uint8_t> Packet::GetRawExtension(int id) const {
+ if (id == ExtensionManager::kInvalidId)
+ return nullptr;
RTC_DCHECK_GE(id, kMinExtensionId);
RTC_DCHECK_LE(id, kMaxExtensionId);
const ExtensionInfo& extension = extension_entries_[id - 1];
@@ -303,6 +307,8 @@ bool Packet::SetRawExtension(int id, rtc::ArrayView<const uint8_t> data) {
}
rtc::ArrayView<uint8_t> Packet::AllocateRawExtension(int id, size_t length) {
+ if (id == ExtensionManager::kInvalidId)
+ return nullptr;
RTC_DCHECK_GE(id, kMinExtensionId);
RTC_DCHECK_LE(id, kMaxExtensionId);
RTC_DCHECK_GE(length, 1);
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698