Remove raw extensions accessors from rtp packet

These accessors were introduced in https://codereview.webrtc.org/2789773004
for dynamic size extensions.
They are now implemented without need of these raw functions

Bug: None
Change-Id: Id43f0bcbf951d60ebeece49556b093956c5ad2bf
Reviewed-on: https://webrtc-review.googlesource.com/92626
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24242}
This commit is contained in:
Danil Chapovalov
2018-08-06 19:34:32 +02:00
committed by Commit Bot
parent 8d2995b865
commit 527ff1eec2
3 changed files with 17 additions and 115 deletions

View File

@ -251,37 +251,7 @@ void RtpPacket::SetCsrcs(const std::vector<uint32_t>& csrcs) {
buffer_.SetSize(payload_offset_);
}
bool RtpPacket::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> RtpPacket::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];
if (extension.offset == 0)
return nullptr;
return rtc::MakeArrayView(data() + extension.offset, extension.length);
}
bool RtpPacket::SetRawExtension(int id, rtc::ArrayView<const uint8_t> data) {
auto buffer = AllocateRawExtension(id, data.size());
if (buffer.empty())
return false;
RTC_DCHECK_EQ(buffer.size(), data.size());
memcpy(buffer.data(), data.data(), data.size());
return true;
}
rtc::ArrayView<uint8_t> RtpPacket::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);