diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 9f6d9f3160..6eec2f4a4c 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -197,6 +197,7 @@ rtc_static_library("video_coding") { "../../system_wrappers", "../rtp_rtcp:rtp_rtcp_format", "../utility:utility", + "//third_party/abseil-cpp/absl/container:inlined_vector", "//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:variant", ] diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc index e4540311b1..bd1d321e01 100644 --- a/modules/video_coding/frame_buffer2.cc +++ b/modules/video_coding/frame_buffer2.cc @@ -479,7 +479,7 @@ void FrameBuffer::PropagateContinuity(FrameMap::iterator start) { // Loop through all dependent frames, and if that frame no longer has // any unfulfilled dependencies then that frame is continuous as well. - for (size_t d = 0; d < frame->second.num_dependent_frames; ++d) { + for (size_t d = 0; d < frame->second.dependent_frames.size(); ++d) { auto frame_ref = frames_.find(frame->second.dependent_frames[d]); RTC_DCHECK(frame_ref != frames_.end()); @@ -497,8 +497,7 @@ void FrameBuffer::PropagateContinuity(FrameMap::iterator start) { void FrameBuffer::PropagateDecodability(const FrameInfo& info) { TRACE_EVENT0("webrtc", "FrameBuffer::PropagateDecodability"); - RTC_CHECK(info.num_dependent_frames < FrameInfo::kMaxNumDependentFrames); - for (size_t d = 0; d < info.num_dependent_frames; ++d) { + for (size_t d = 0; d < info.dependent_frames.size(); ++d) { auto ref_info = frames_.find(info.dependent_frames[d]); RTC_DCHECK(ref_info != frames_.end()); // TODO(philipel): Look into why we've seen this happen. @@ -608,20 +607,7 @@ bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const EncodedFrame& frame, if (dep.continuous) --info->second.num_missing_continuous; - // At this point we know we want to insert this frame, so here we - // intentionally get or create the FrameInfo for this dependency. - FrameInfo* dep_info = &frames_[dep.id]; - - if (dep_info->num_dependent_frames < - (FrameInfo::kMaxNumDependentFrames - 1)) { - dep_info->dependent_frames[dep_info->num_dependent_frames] = id; - ++dep_info->num_dependent_frames; - } else { - RTC_LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" - << dep.id.picture_id << ":" - << static_cast(dep.id.spatial_layer) - << ") is referenced by too many frames."; - } + frames_[dep.id].dependent_frames.push_back(id); } return true; diff --git a/modules/video_coding/frame_buffer2.h b/modules/video_coding/frame_buffer2.h index c311bc8f2f..8d5416d8ad 100644 --- a/modules/video_coding/frame_buffer2.h +++ b/modules/video_coding/frame_buffer2.h @@ -17,6 +17,7 @@ #include #include +#include "absl/container/inlined_vector.h" #include "api/video/encoded_frame.h" #include "modules/video_coding/include/video_coding_defines.h" #include "modules/video_coding/inter_frame_delay.h" @@ -89,15 +90,9 @@ class FrameBuffer { FrameInfo(FrameInfo&&); ~FrameInfo(); - // The maximum number of frames that can depend on this frame. - static constexpr size_t kMaxNumDependentFrames = 8; - // Which other frames that have direct unfulfilled dependencies // on this frame. - // TODO(philipel): Add simple modify/access functions to prevent adding too - // many |dependent_frames|. - VideoLayerFrameId dependent_frames[kMaxNumDependentFrames]; - size_t num_dependent_frames = 0; + absl::InlinedVector dependent_frames; // A frame is continiuous if it has all its referenced/indirectly // referenced frames.