From e209fe6c68f6ad83f1f8ec715ecf45f9934739c2 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 12 Feb 2020 19:25:57 +0100 Subject: [PATCH] Do not propagate generic descriptor on receiving frame It was used only for the frame decryptor. Decryptor needs only raw representation that it can recreate in a way compatible with the new version of the descriptor. This relands commit abf73de8eae90e9ac7e88ce1d52728e8102e824f. with adjustments. Change-Id: I935977179bef31d8e1023964b967658e9a7db92d Bug: webrtc:10342 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168489 Reviewed-by: Sam Zackrisson Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#30532} --- modules/rtp_rtcp/BUILD.gn | 2 + .../source/rtp_descriptor_authentication.cc | 58 ++++++++++++++++++ .../source/rtp_descriptor_authentication.h | 27 ++++++++ .../source/rtp_generic_frame_descriptor.cc | 18 ------ .../source/rtp_generic_frame_descriptor.h | 5 -- modules/video_coding/BUILD.gn | 1 + modules/video_coding/frame_object.cc | 44 ++++++++++--- modules/video_coding/frame_object.h | 23 ++++++- modules/video_coding/packet_buffer.cc | 1 - modules/video_coding/packet_buffer.h | 2 - .../rtp_frame_reference_finder_unittest.cc | 1 - .../rtp_frame_reference_finder_fuzzer.cc | 44 +++++++------ video/buffered_frame_decryptor.cc | 11 ++-- video/buffered_frame_decryptor_unittest.cc | 5 +- video/rtp_video_stream_receiver.cc | 61 ++++++++----------- 15 files changed, 206 insertions(+), 97 deletions(-) create mode 100644 modules/rtp_rtcp/source/rtp_descriptor_authentication.cc create mode 100644 modules/rtp_rtcp/source/rtp_descriptor_authentication.h diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn index 90055480b6..f7ce1ab936 100644 --- a/modules/rtp_rtcp/BUILD.gn +++ b/modules/rtp_rtcp/BUILD.gn @@ -165,6 +165,8 @@ rtc_library("rtp_rtcp") { "source/rtcp_receiver.h", "source/rtcp_sender.cc", "source/rtcp_sender.h", + "source/rtp_descriptor_authentication.cc", + "source/rtp_descriptor_authentication.h", "source/rtp_format.cc", "source/rtp_format.h", "source/rtp_format_h264.cc", diff --git a/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc b/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc new file mode 100644 index 0000000000..f4525f0db1 --- /dev/null +++ b/modules/rtp_rtcp/source/rtp_descriptor_authentication.cc @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h" + +#include +#include + +#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" +#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h" +#include "modules/rtp_rtcp/source/rtp_video_header.h" + +namespace webrtc { + +std::vector RtpDescriptorAuthentication( + const RTPVideoHeader& rtp_video_header) { + if (!rtp_video_header.generic) { + return {}; + } + const RTPVideoHeader::GenericDescriptorInfo& descriptor = + *rtp_video_header.generic; + // Default way of creating additional data for an encrypted frame. + if (descriptor.spatial_index < 0 || descriptor.temporal_index < 0 || + descriptor.spatial_index >= + RtpGenericFrameDescriptor::kMaxSpatialLayers || + descriptor.temporal_index >= + RtpGenericFrameDescriptor::kMaxTemporalLayers || + descriptor.dependencies.size() > + RtpGenericFrameDescriptor::kMaxNumFrameDependencies) { + return {}; + } + RtpGenericFrameDescriptor frame_descriptor; + frame_descriptor.SetFirstPacketInSubFrame(true); + frame_descriptor.SetLastPacketInSubFrame(false); + frame_descriptor.SetTemporalLayer(descriptor.temporal_index); + frame_descriptor.SetSpatialLayersBitmask(1 << descriptor.spatial_index); + frame_descriptor.SetFrameId(descriptor.frame_id & 0xFFFF); + for (int64_t dependency : descriptor.dependencies) { + frame_descriptor.AddFrameDependencyDiff(descriptor.frame_id - dependency); + } + if (descriptor.dependencies.empty()) { + frame_descriptor.SetResolution(rtp_video_header.width, + rtp_video_header.height); + } + std::vector result( + RtpGenericFrameDescriptorExtension00::ValueSize(frame_descriptor)); + RtpGenericFrameDescriptorExtension00::Write(result, frame_descriptor); + return result; +} + +} // namespace webrtc diff --git a/modules/rtp_rtcp/source/rtp_descriptor_authentication.h b/modules/rtp_rtcp/source/rtp_descriptor_authentication.h new file mode 100644 index 0000000000..1791abecd8 --- /dev/null +++ b/modules/rtp_rtcp/source/rtp_descriptor_authentication.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef MODULES_RTP_RTCP_SOURCE_RTP_DESCRIPTOR_AUTHENTICATION_H_ +#define MODULES_RTP_RTCP_SOURCE_RTP_DESCRIPTOR_AUTHENTICATION_H_ + +#include +#include + +#include "modules/rtp_rtcp/source/rtp_video_header.h" + +namespace webrtc { + +// Converts frame dependencies into array of bytes for authentication. +std::vector RtpDescriptorAuthentication( + const RTPVideoHeader& rtp_video_header); + +} // namespace webrtc + +#endif // MODULES_RTP_RTCP_SOURCE_RTP_DESCRIPTOR_AUTHENTICATION_H_ diff --git a/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.cc b/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.cc index 7a8af09927..465308ec45 100644 --- a/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.cc +++ b/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.cc @@ -97,22 +97,4 @@ bool RtpGenericFrameDescriptor::AddFrameDependencyDiff(uint16_t fdiff) { return true; } -void RtpGenericFrameDescriptor::SetByteRepresentation( - rtc::ArrayView byte_representation) { - RTC_CHECK(!byte_representation.empty()); - byte_representation_.assign(byte_representation.begin(), - byte_representation.end()); - // Clear end_of_subframe bit. - // Because ByteRepresentation is used for frame authentication, bit describing - // position of the packet in the frame shouldn't be part of it. - // This match RtpVideoSender where descriptor is passed for authentication - // before end_of_subframe bit is decided and set, i.e. it is always 0. - byte_representation_[0] &= ~0x40; -} - -rtc::ArrayView -RtpGenericFrameDescriptor::GetByteRepresentation() { - return byte_representation_; -} - } // namespace webrtc diff --git a/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h b/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h index 9e79455aff..1b83307849 100644 --- a/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h +++ b/modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h @@ -70,9 +70,6 @@ class RtpGenericFrameDescriptor { // Returns false on failure, i.e. number of dependencies is too large. bool AddFrameDependencyDiff(uint16_t fdiff); - void SetByteRepresentation(rtc::ArrayView representation); - rtc::ArrayView GetByteRepresentation(); - private: bool beginning_of_subframe_ = false; bool end_of_subframe_ = false; @@ -86,8 +83,6 @@ class RtpGenericFrameDescriptor { uint16_t frame_deps_id_diffs_[kMaxNumFrameDependencies]; int width_ = 0; int height_ = 0; - - std::vector byte_representation_; }; } // namespace webrtc diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 77f6186633..935151f20e 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -84,6 +84,7 @@ rtc_library("video_coding") { "../../api/video:encoded_image", "../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocator_factory", + "../../rtc_base:deprecation", "../../system_wrappers:field_trial", "../../system_wrappers:metrics", "../rtp_rtcp:rtp_video_header", diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc index 682ce17f9c..7152c3b2ce 100644 --- a/modules/video_coding/frame_object.cc +++ b/modules/video_coding/frame_object.cc @@ -37,7 +37,6 @@ RtpFrameObject::RtpFrameObject( VideoContentType content_type, const RTPVideoHeader& video_header, const absl::optional& color_space, - const absl::optional& generic_descriptor, RtpPacketInfos packet_infos, rtc::scoped_refptr image_buffer) : first_seq_num_(first_seq_num), @@ -45,7 +44,6 @@ RtpFrameObject::RtpFrameObject( last_packet_received_time_(last_packet_received_time), times_nacked_(times_nacked) { rtp_video_header_ = video_header; - rtp_generic_frame_descriptor_ = generic_descriptor; // EncodedFrame members codec_type_ = codec; @@ -92,6 +90,43 @@ RtpFrameObject::RtpFrameObject( is_last_spatial_layer = markerBit; } +RtpFrameObject::RtpFrameObject( + uint16_t first_seq_num, + uint16_t last_seq_num, + bool markerBit, + int times_nacked, + int64_t first_packet_received_time, + int64_t last_packet_received_time, + uint32_t rtp_timestamp, + int64_t ntp_time_ms, + const VideoSendTiming& timing, + uint8_t payload_type, + VideoCodecType codec, + VideoRotation rotation, + VideoContentType content_type, + const RTPVideoHeader& video_header, + const absl::optional& color_space, + const absl::optional& /*generic_descriptor*/, + RtpPacketInfos packet_infos, + rtc::scoped_refptr image_buffer) + : RtpFrameObject(first_seq_num, + last_seq_num, + markerBit, + times_nacked, + first_packet_received_time, + last_packet_received_time, + rtp_timestamp, + ntp_time_ms, + timing, + payload_type, + codec, + rotation, + content_type, + video_header, + color_space, + std::move(packet_infos), + std::move(image_buffer)) {} + RtpFrameObject::~RtpFrameObject() { } @@ -131,11 +166,6 @@ const RTPVideoHeader& RtpFrameObject::GetRtpVideoHeader() const { return rtp_video_header_; } -const absl::optional& -RtpFrameObject::GetGenericFrameDescriptor() const { - return rtp_generic_frame_descriptor_; -} - const FrameMarking& RtpFrameObject::GetFrameMarking() const { return rtp_video_header_.frame_marking; } diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h index b3cee20ae4..f43fafd9a8 100644 --- a/modules/video_coding/frame_object.h +++ b/modules/video_coding/frame_object.h @@ -14,12 +14,32 @@ #include "absl/types/optional.h" #include "api/video/encoded_frame.h" #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" +#include "rtc_base/deprecation.h" namespace webrtc { namespace video_coding { class RtpFrameObject : public EncodedFrame { public: + RtpFrameObject(uint16_t first_seq_num, + uint16_t last_seq_num, + bool markerBit, + int times_nacked, + int64_t first_packet_received_time, + int64_t last_packet_received_time, + uint32_t rtp_timestamp, + int64_t ntp_time_ms, + const VideoSendTiming& timing, + uint8_t payload_type, + VideoCodecType codec, + VideoRotation rotation, + VideoContentType content_type, + const RTPVideoHeader& video_header, + const absl::optional& color_space, + RtpPacketInfos packet_infos, + rtc::scoped_refptr image_buffer); + + RTC_DEPRECATED RtpFrameObject( uint16_t first_seq_num, uint16_t last_seq_num, @@ -50,13 +70,10 @@ class RtpFrameObject : public EncodedFrame { int64_t RenderTime() const override; bool delayed_by_retransmission() const override; const RTPVideoHeader& GetRtpVideoHeader() const; - const absl::optional& GetGenericFrameDescriptor() - const; const FrameMarking& GetFrameMarking() const; private: RTPVideoHeader rtp_video_header_; - absl::optional rtp_generic_frame_descriptor_; VideoCodecType codec_type_; uint16_t first_seq_num_; uint16_t last_seq_num_; diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc index 6ebb9c4c9b..73abbbe25a 100644 --- a/modules/video_coding/packet_buffer.cc +++ b/modules/video_coding/packet_buffer.cc @@ -473,7 +473,6 @@ std::unique_ptr PacketBuffer::AssembleFrame( last_packet.video_header.content_type, // first_packet.video_header, // last_packet.video_header.color_space, // - first_packet.generic_descriptor, // RtpPacketInfos(std::move(packet_infos)), // std::move(bitstream)); } diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h index f78147c78e..5ce67bafef 100644 --- a/modules/video_coding/packet_buffer.h +++ b/modules/video_coding/packet_buffer.h @@ -19,7 +19,6 @@ #include "absl/base/attributes.h" #include "api/rtp_packet_info.h" #include "api/video/encoded_image.h" -#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "modules/rtp_rtcp/source/rtp_video_header.h" #include "modules/video_coding/frame_object.h" @@ -67,7 +66,6 @@ class PacketBuffer { rtc::CopyOnWriteBuffer video_payload; RTPVideoHeader video_header; - absl::optional generic_descriptor; RtpPacketInfo packet_info; }; diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc index 29fdba53a5..e103023420 100644 --- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc +++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc @@ -57,7 +57,6 @@ std::unique_ptr CreateFrame( VideoContentType::UNSPECIFIED, video_header, /*color_space=*/absl::nullopt, - /*generic_descriptor=*/absl::nullopt, RtpPacketInfos(), EncodedImageBuffer::Create(/*size=*/0)); // clang-format on diff --git a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc index 0aa8e75a16..96eca94178 100644 --- a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc +++ b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc @@ -63,25 +63,31 @@ class NullCallback : public video_coding::OnCompleteFrameCallback { std::unique_ptr frame) override {} }; -RtpGenericFrameDescriptor GenerateRtpGenericFrameDescriptor( - DataReader* reader) { - RtpGenericFrameDescriptor res; - res.SetFirstPacketInSubFrame(true); - res.SetFrameId(reader->GetNum()); - - int spatial_layer = - reader->GetNum() % RtpGenericFrameDescriptor::kMaxSpatialLayers; - res.SetSpatialLayersBitmask(1 << spatial_layer); - res.SetTemporalLayer(reader->GetNum() % - RtpGenericFrameDescriptor::kMaxTemporalLayers); - - int num_diffs = (reader->GetNum() % - RtpGenericFrameDescriptor::kMaxNumFrameDependencies); - for (int i = 0; i < num_diffs; ++i) { - res.AddFrameDependencyDiff(reader->GetNum() % (1 << 14)); +absl::optional +GenerateGenericFrameDependencies(DataReader* reader) { + absl::optional result; + uint8_t flags = reader->GetNum(); + if (flags & 0b1000'0000) { + // i.e. with 50% chance there are no generic dependencies. + // in such case codec-specfic code path of the RtpFrameReferenceFinder will + // be validated. + return result; } - return res; + result.emplace(); + result->frame_id = reader->GetNum(); + result->spatial_index = (flags & 0b0111'0000) >> 4; + result->temporal_index = (flags & 0b0000'1110) >> 1; + result->discardable = (flags & 0b0000'0001); + + // Larger than supported by the RtpFrameReferenceFinder. + int num_diffs = (reader->GetNum() % 16); + for (int i = 0; i < num_diffs; ++i) { + result->dependencies.push_back(result->frame_id - + (reader->GetNum() % (1 << 14))); + } + + return result; } } // namespace @@ -90,7 +96,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { NullCallback cb; video_coding::RtpFrameReferenceFinder reference_finder(&cb); - auto codec = static_cast(reader.GetNum() % 4); + auto codec = static_cast(reader.GetNum() % 5); while (reader.MoreToRead()) { uint16_t first_seq_num = reader.GetNum(); @@ -128,6 +134,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { } reader.CopyTo(&video_header.frame_marking); + video_header.generic = GenerateGenericFrameDependencies(&reader); // clang-format off auto frame = std::make_unique( @@ -146,7 +153,6 @@ void FuzzOneInput(const uint8_t* data, size_t size) { VideoContentType::UNSPECIFIED, video_header, /*color_space=*/absl::nullopt, - GenerateRtpGenericFrameDescriptor(&reader), RtpPacketInfos(), EncodedImageBuffer::Create(/*size=*/0)); // clang-format on diff --git a/video/buffered_frame_decryptor.cc b/video/buffered_frame_decryptor.cc index 90d14d38c2..ae83da940c 100644 --- a/video/buffered_frame_decryptor.cc +++ b/video/buffered_frame_decryptor.cc @@ -11,7 +11,10 @@ #include "video/buffered_frame_decryptor.h" #include +#include +#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h" +#include "modules/video_coding/frame_object.h" #include "rtc_base/logging.h" #include "system_wrappers/include/field_trial.h" @@ -60,9 +63,7 @@ BufferedFrameDecryptor::FrameDecision BufferedFrameDecryptor::DecryptFrame( return FrameDecision::kStash; } // When using encryption we expect the frame to have the generic descriptor. - absl::optional descriptor = - frame->GetGenericFrameDescriptor(); - if (!descriptor) { + if (frame->GetRtpVideoHeader().generic == absl::nullopt) { RTC_LOG(LS_ERROR) << "No generic frame descriptor found dropping frame."; return FrameDecision::kDrop; } @@ -76,9 +77,9 @@ BufferedFrameDecryptor::FrameDecision BufferedFrameDecryptor::DecryptFrame( max_plaintext_byte_size); // Only enable authenticating the header if the field trial is enabled. - rtc::ArrayView additional_data; + std::vector additional_data; if (generic_descriptor_auth_experiment_) { - additional_data = descriptor->GetByteRepresentation(); + additional_data = RtpDescriptorAuthentication(frame->GetRtpVideoHeader()); } // Attempt to decrypt the video frame. diff --git a/video/buffered_frame_decryptor_unittest.cc b/video/buffered_frame_decryptor_unittest.cc index 1b21acfb85..bbc08b0da3 100644 --- a/video/buffered_frame_decryptor_unittest.cc +++ b/video/buffered_frame_decryptor_unittest.cc @@ -57,6 +57,8 @@ class BufferedFrameDecryptorTest : public ::testing::Test, std::unique_ptr CreateRtpFrameObject( bool key_frame) { seq_num_++; + RTPVideoHeader rtp_video_header; + rtp_video_header.generic.emplace(); // clang-format off return std::make_unique( @@ -73,9 +75,8 @@ class BufferedFrameDecryptorTest : public ::testing::Test, kVideoCodecGeneric, kVideoRotation_0, VideoContentType::UNSPECIFIED, - RTPVideoHeader(), + rtp_video_header, /*color_space=*/absl::nullopt, - RtpGenericFrameDescriptor(), RtpPacketInfos(), EncodedImageBuffer::Create(/*size=*/0)); // clang-format on diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc index 9f5fe0248e..cce557a878 100644 --- a/video/rtp_video_stream_receiver.cc +++ b/video/rtp_video_stream_receiver.cc @@ -28,6 +28,7 @@ #include "modules/rtp_rtcp/include/ulpfec_receiver.h" #include "modules/rtp_rtcp/source/create_video_rtp_depacketizer.h" #include "modules/rtp_rtcp/source/rtp_format.h" +#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h" #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" @@ -367,51 +368,43 @@ void RtpVideoStreamReceiver::OnReceivedPayloadData( rtp_packet.GetExtension(&video_header.playout_delay); rtp_packet.GetExtension(&video_header.frame_marking); - RtpGenericFrameDescriptor& generic_descriptor = - packet->generic_descriptor.emplace(); - if (rtp_packet.GetExtension( - &generic_descriptor)) { - if (rtp_packet.HasExtension()) { - RTC_LOG(LS_WARNING) << "RTP packet had two different GFD versions."; - return; - } - generic_descriptor.SetByteRepresentation( - rtp_packet.GetRawExtension()); - } else if ((rtp_packet.GetExtension( - &generic_descriptor))) { - generic_descriptor.SetByteRepresentation( - rtp_packet.GetRawExtension()); - } else { - packet->generic_descriptor = absl::nullopt; + if (rtp_packet.HasExtension() && + rtp_packet.HasExtension()) { + RTC_LOG(LS_WARNING) << "RTP packet had two different GFD versions."; + return; } - if (packet->generic_descriptor != absl::nullopt) { - video_header.is_first_packet_in_frame = - packet->generic_descriptor->FirstPacketInSubFrame(); - video_header.is_last_packet_in_frame = - packet->generic_descriptor->LastPacketInSubFrame(); - if (packet->generic_descriptor->FirstPacketInSubFrame()) { + RtpGenericFrameDescriptor generic_descriptor; + bool has_generic_descriptor = + rtp_packet.GetExtension( + &generic_descriptor) || + rtp_packet.GetExtension( + &generic_descriptor); + if (has_generic_descriptor) { + video_header.is_first_packet_in_frame = + generic_descriptor.FirstPacketInSubFrame(); + video_header.is_last_packet_in_frame = + generic_descriptor.LastPacketInSubFrame(); + + if (generic_descriptor.FirstPacketInSubFrame()) { video_header.frame_type = - packet->generic_descriptor->FrameDependenciesDiffs().empty() + generic_descriptor.FrameDependenciesDiffs().empty() ? VideoFrameType::kVideoFrameKey : VideoFrameType::kVideoFrameDelta; auto& descriptor = video_header.generic.emplace(); int64_t frame_id = - frame_id_unwrapper_.Unwrap(packet->generic_descriptor->FrameId()); + frame_id_unwrapper_.Unwrap(generic_descriptor.FrameId()); descriptor.frame_id = frame_id; - descriptor.spatial_index = packet->generic_descriptor->SpatialLayer(); - descriptor.temporal_index = packet->generic_descriptor->TemporalLayer(); - descriptor.discardable = - packet->generic_descriptor->Discardable().value_or(false); - for (uint16_t fdiff : - packet->generic_descriptor->FrameDependenciesDiffs()) { + descriptor.spatial_index = generic_descriptor.SpatialLayer(); + descriptor.temporal_index = generic_descriptor.TemporalLayer(); + descriptor.discardable = generic_descriptor.Discardable().value_or(false); + for (uint16_t fdiff : generic_descriptor.FrameDependenciesDiffs()) { descriptor.dependencies.push_back(frame_id - fdiff); } } - - video_header.width = packet->generic_descriptor->Width(); - video_header.height = packet->generic_descriptor->Height(); + video_header.width = generic_descriptor.Width(); + video_header.height = generic_descriptor.Height(); } // Color space should only be transmitted in the last packet of a frame, @@ -435,7 +428,7 @@ void RtpVideoStreamReceiver::OnReceivedPayloadData( // TODO(bugs.webrtc.org/10336): Implement support for reordering. RTC_LOG(LS_INFO) << "LossNotificationController does not support reordering."; - } else if (!packet->generic_descriptor) { + } else if (!has_generic_descriptor) { RTC_LOG(LS_WARNING) << "LossNotificationController requires generic " "frame descriptor, but it is missing."; } else {