Remove extra trait to read only mandatory part of the dependency descriptor

Same can be achieved by having multiple Parse functions in the same
RtpDependencyDescriptorExtension trait

Bug: None
Change-Id: I4eab0001d1ffff631a9d70fafde13e51f5c6ce36
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/340320
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41786}
This commit is contained in:
Danil Chapovalov 2024-02-22 13:58:27 +01:00 committed by WebRTC LUCI CQ
parent d440358cca
commit b2f827cb79
3 changed files with 7 additions and 12 deletions

View File

@ -52,7 +52,7 @@ bool RtpDependencyDescriptorExtension::Write(
return writer.Write(); return writer.Write();
} }
bool RtpDependencyDescriptorExtensionMandatory::Parse( bool RtpDependencyDescriptorExtension::Parse(
rtc::ArrayView<const uint8_t> data, rtc::ArrayView<const uint8_t> data,
DependencyDescriptorMandatory* descriptor) { DependencyDescriptorMandatory* descriptor) {
if (data.size() < 3) { if (data.size() < 3) {

View File

@ -33,6 +33,11 @@ class RtpDependencyDescriptorExtension {
const FrameDependencyStructure* structure, const FrameDependencyStructure* structure,
DependencyDescriptor* descriptor); DependencyDescriptor* descriptor);
// Reads the mandatory part of the descriptor.
// Such read is stateless, i.e., doesn't require `FrameDependencyStructure`.
static bool Parse(rtc::ArrayView<const uint8_t> data,
DependencyDescriptorMandatory* descriptor);
static size_t ValueSize(const FrameDependencyStructure& structure, static size_t ValueSize(const FrameDependencyStructure& structure,
const DependencyDescriptor& descriptor) { const DependencyDescriptor& descriptor) {
return ValueSize(structure, kAllChainsAreActive, descriptor); return ValueSize(structure, kAllChainsAreActive, descriptor);
@ -54,16 +59,6 @@ class RtpDependencyDescriptorExtension {
static constexpr std::bitset<32> kAllChainsAreActive = ~uint32_t{0}; static constexpr std::bitset<32> kAllChainsAreActive = ~uint32_t{0};
}; };
// Trait to only read the mandatory part of the descriptor.
class RtpDependencyDescriptorExtensionMandatory {
public:
static constexpr webrtc::RTPExtensionType kId =
webrtc::RtpDependencyDescriptorExtension::kId;
static bool Parse(rtc::ArrayView<const uint8_t> data,
DependencyDescriptorMandatory* descriptor);
};
} // namespace webrtc } // namespace webrtc
#endif // MODULES_RTP_RTCP_SOURCE_RTP_DEPENDENCY_DESCRIPTOR_EXTENSION_H_ #endif // MODULES_RTP_RTCP_SOURCE_RTP_DEPENDENCY_DESCRIPTOR_EXTENSION_H_

View File

@ -432,7 +432,7 @@ RtpVideoStreamReceiver2::ParseGenericDependenciesExtension(
RTPVideoHeader* video_header) { RTPVideoHeader* video_header) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
if (DependencyDescriptorMandatory dd_mandatory; if (DependencyDescriptorMandatory dd_mandatory;
rtp_packet.GetExtension<RtpDependencyDescriptorExtensionMandatory>( rtp_packet.GetExtension<RtpDependencyDescriptorExtension>(
&dd_mandatory)) { &dd_mandatory)) {
const int64_t frame_id = const int64_t frame_id =
frame_id_unwrapper_.Unwrap(dd_mandatory.frame_number()); frame_id_unwrapper_.Unwrap(dd_mandatory.frame_number());