In RtpFrameReferenceFinder discard frames with too large spatial id

Bug: chromium:41495253
Change-Id: I681f64edfcba319ab9479a2ad10987452cf9b6d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341265
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41829}
This commit is contained in:
Danil Chapovalov 2024-02-27 17:51:42 +01:00 committed by WebRTC LUCI CQ
parent 8cd50cbbdc
commit c3d937b3e4
2 changed files with 9 additions and 1 deletions

View File

@ -233,6 +233,7 @@ rtc_library("video_coding") {
"../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocation",
"../../api/video:video_bitrate_allocator", "../../api/video:video_bitrate_allocator",
"../../api/video:video_bitrate_allocator_factory", "../../api/video:video_bitrate_allocator_factory",
"../../api/video:video_codec_constants",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video:video_frame_type", "../../api/video:video_frame_type",
"../../api/video:video_rtp_headers", "../../api/video:video_rtp_headers",

View File

@ -12,6 +12,7 @@
#include <utility> #include <utility>
#include "api/video/video_codec_constants.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
namespace webrtc { namespace webrtc {
@ -19,6 +20,13 @@ namespace webrtc {
RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame( RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame(
std::unique_ptr<RtpFrameObject> frame, std::unique_ptr<RtpFrameObject> frame,
const RTPVideoHeader::GenericDescriptorInfo& descriptor) { const RTPVideoHeader::GenericDescriptorInfo& descriptor) {
RtpFrameReferenceFinder::ReturnVector res;
if (descriptor.spatial_index >= kMaxSpatialLayers) {
RTC_LOG(LS_WARNING) << "Spatial index " << descriptor.spatial_index
<< " is unsupported.";
return res;
}
// Frame IDs are unwrapped in the RtpVideoStreamReceiver, no need to unwrap // Frame IDs are unwrapped in the RtpVideoStreamReceiver, no need to unwrap
// them here. // them here.
frame->SetId(descriptor.frame_id); frame->SetId(descriptor.frame_id);
@ -26,7 +34,6 @@ RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame(
if (descriptor.temporal_index != kNoTemporalIdx) if (descriptor.temporal_index != kNoTemporalIdx)
frame->SetTemporalIndex(descriptor.temporal_index); frame->SetTemporalIndex(descriptor.temporal_index);
RtpFrameReferenceFinder::ReturnVector res;
if (EncodedFrame::kMaxFrameReferences < descriptor.dependencies.size()) { if (EncodedFrame::kMaxFrameReferences < descriptor.dependencies.size()) {
RTC_LOG(LS_WARNING) << "Too many dependencies in generic descriptor."; RTC_LOG(LS_WARNING) << "Too many dependencies in generic descriptor.";
return res; return res;