In dependency descriptor remove extended fields indicator

to follow PR64 spec change
https://github.com/AOMediaCodec/av1-rtp-spec/pull/64

Bug: webrtc:10342
Change-Id: Ic082d5e551b5f38427d5a43be987b0d35f6ea155
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160001
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29832}
This commit is contained in:
Danil Chapovalov
2019-11-19 11:44:06 +01:00
committed by Commit Bot
parent fe047757d6
commit 063c7d18c0
2 changed files with 8 additions and 22 deletions

View File

@ -21,9 +21,7 @@ namespace {
constexpr int kMaxTemporalId = 7;
constexpr int kMaxSpatialId = 3;
constexpr int kMaxTemplates = 63;
constexpr int kMaxTemplateId = kMaxTemplates - 1;
constexpr int kExtendedFieldsIndicator = kMaxTemplates;
constexpr int kMaxTemplates = 64;
} // namespace
@ -35,7 +33,7 @@ RtpDependencyDescriptorReader::RtpDependencyDescriptorReader(
RTC_DCHECK(descriptor);
ReadMandatoryFields();
if (frame_dependency_template_id_ == kExtendedFieldsIndicator)
if (raw_data.size() > 3)
ReadExtendedFields();
structure_ = descriptor->attached_structure
@ -71,11 +69,6 @@ void RtpDependencyDescriptorReader::ReadTemplateDependencyStructure() {
descriptor_->attached_structure =
std::make_unique<FrameDependencyStructure>();
descriptor_->attached_structure->structure_id = ReadBits(6);
if (descriptor_->attached_structure->structure_id ==
kExtendedFieldsIndicator) {
parsing_failed_ = true;
return;
}
descriptor_->attached_structure->num_decode_targets = ReadBits(5) + 1;
ReadTemplateLayers();
@ -189,11 +182,6 @@ void RtpDependencyDescriptorReader::ReadMandatoryFields() {
}
void RtpDependencyDescriptorReader::ReadExtendedFields() {
frame_dependency_template_id_ = ReadBits(6);
if (frame_dependency_template_id_ == kExtendedFieldsIndicator) {
parsing_failed_ = true;
return;
}
bool template_dependency_structure_present_flag = ReadBits(1);
active_decode_targets_present_flag_ = ReadBits(1);
custom_dtis_flag_ = ReadBits(1);
@ -209,9 +197,9 @@ void RtpDependencyDescriptorReader::ReadExtendedFields() {
}
void RtpDependencyDescriptorReader::ReadFrameDependencyDefinition() {
size_t template_index = (frame_dependency_template_id_ +
(kMaxTemplateId + 1) - structure_->structure_id) %
(kMaxTemplateId + 1);
size_t template_index = (frame_dependency_template_id_ + kMaxTemplates -
structure_->structure_id) %
kMaxTemplates;
if (template_index >= structure_->templates.size()) {
parsing_failed_ = true;

View File

@ -23,7 +23,7 @@
namespace webrtc {
namespace {
constexpr int kMaxTemplates = 63;
constexpr int kMaxTemplates = 64;
enum class NextLayerIdc : uint64_t {
kSameLayer = 0,
@ -81,7 +81,7 @@ int RtpDependencyDescriptorWriter::ValueSizeBits() const {
static constexpr int kMandatoryFields = 1 + 1 + 6 + 16;
int value_size_bits = kMandatoryFields + best_template_.extra_size_bits;
if (HasExtendedFields()) {
value_size_bits += 11;
value_size_bits += 5;
if (descriptor_.attached_structure)
value_size_bits += StructureSizeBits();
if (ShouldWriteActiveDecodeTargetsBitmask())
@ -304,15 +304,13 @@ void RtpDependencyDescriptorWriter::WriteResolutions() {
}
void RtpDependencyDescriptorWriter::WriteMandatoryFields() {
static constexpr uint64_t kExtendedFieldsIndicator = 0b111111;
WriteBits(descriptor_.first_packet_in_frame, 1);
WriteBits(descriptor_.last_packet_in_frame, 1);
WriteBits(HasExtendedFields() ? kExtendedFieldsIndicator : TemplateId(), 6);
WriteBits(TemplateId(), 6);
WriteBits(descriptor_.frame_number, 16);
}
void RtpDependencyDescriptorWriter::WriteExtendedFields() {
WriteBits(TemplateId(), 6);
uint64_t template_dependency_structure_present_flag =
descriptor_.attached_structure ? 1u : 0u;
WriteBits(template_dependency_structure_present_flag, 1);