Embed FrameDependencyTemplate builder helpers directly into the struct

Bug: None
Change-Id: I4c13bdabd08dd6a6011cb534c765c1dd09f218d1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176843
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31500}
diff --git a/api/transport/rtp/BUILD.gn b/api/transport/rtp/BUILD.gn
index dc96a6a..7b01169 100644
--- a/api/transport/rtp/BUILD.gn
+++ b/api/transport/rtp/BUILD.gn
@@ -20,9 +20,14 @@
 
 rtc_source_set("dependency_descriptor") {
   visibility = [ "*" ]
-  sources = [ "dependency_descriptor.h" ]
+  sources = [
+    "dependency_descriptor.cc",
+    "dependency_descriptor.h",
+  ]
+  deps = [ "../../../rtc_base:checks" ]
   absl_deps = [
     "//third_party/abseil-cpp/absl/container:inlined_vector",
+    "//third_party/abseil-cpp/absl/strings",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
 }
diff --git a/api/transport/rtp/dependency_descriptor.cc b/api/transport/rtp/dependency_descriptor.cc
new file mode 100644
index 0000000..a637ad4
--- /dev/null
+++ b/api/transport/rtp/dependency_descriptor.cc
@@ -0,0 +1,48 @@
+/*
+ *  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 "api/transport/rtp/dependency_descriptor.h"
+
+#include "absl/container/inlined_vector.h"
+#include "absl/strings/string_view.h"
+#include "rtc_base/checks.h"
+
+namespace webrtc {
+namespace webrtc_impl {
+
+absl::InlinedVector<DecodeTargetIndication, 10> StringToDecodeTargetIndications(
+    absl::string_view symbols) {
+  absl::InlinedVector<DecodeTargetIndication, 10> dtis;
+  dtis.reserve(symbols.size());
+  for (char symbol : symbols) {
+    DecodeTargetIndication indication;
+    switch (symbol) {
+      case '-':
+        indication = DecodeTargetIndication::kNotPresent;
+        break;
+      case 'D':
+        indication = DecodeTargetIndication::kDiscardable;
+        break;
+      case 'R':
+        indication = DecodeTargetIndication::kRequired;
+        break;
+      case 'S':
+        indication = DecodeTargetIndication::kSwitch;
+        break;
+      default:
+        RTC_NOTREACHED();
+    }
+    dtis.push_back(indication);
+  }
+  return dtis;
+}
+
+}  // namespace webrtc_impl
+}  // namespace webrtc
diff --git a/api/transport/rtp/dependency_descriptor.h b/api/transport/rtp/dependency_descriptor.h
index a488f56..3129d83 100644
--- a/api/transport/rtp/dependency_descriptor.h
+++ b/api/transport/rtp/dependency_descriptor.h
@@ -13,10 +13,12 @@
 
 #include <stdint.h>
 
+#include <initializer_list>
 #include <memory>
 #include <vector>
 
 #include "absl/container/inlined_vector.h"
+#include "absl/strings/string_view.h"
 #include "absl/types/optional.h"
 
 namespace webrtc {
@@ -52,6 +54,13 @@
 };
 
 struct FrameDependencyTemplate {
+  // Setters are named briefly to chain them when building the template.
+  FrameDependencyTemplate& S(int spatial_layer);
+  FrameDependencyTemplate& T(int temporal_layer);
+  FrameDependencyTemplate& Dtis(absl::string_view dtis);
+  FrameDependencyTemplate& FrameDiffs(std::initializer_list<int> diffs);
+  FrameDependencyTemplate& ChainDiffs(std::initializer_list<int> diffs);
+
   friend bool operator==(const FrameDependencyTemplate& lhs,
                          const FrameDependencyTemplate& rhs) {
     return lhs.spatial_id == rhs.spatial_id &&
@@ -99,6 +108,37 @@
   std::unique_ptr<FrameDependencyStructure> attached_structure;
 };
 
+// Below are implementation details.
+namespace webrtc_impl {
+absl::InlinedVector<DecodeTargetIndication, 10> StringToDecodeTargetIndications(
+    absl::string_view indication_symbols);
+}  // namespace webrtc_impl
+
+inline FrameDependencyTemplate& FrameDependencyTemplate::S(int spatial_layer) {
+  this->spatial_id = spatial_layer;
+  return *this;
+}
+inline FrameDependencyTemplate& FrameDependencyTemplate::T(int temporal_layer) {
+  this->temporal_id = temporal_layer;
+  return *this;
+}
+inline FrameDependencyTemplate& FrameDependencyTemplate::Dtis(
+    absl::string_view dtis) {
+  this->decode_target_indications =
+      webrtc_impl::StringToDecodeTargetIndications(dtis);
+  return *this;
+}
+inline FrameDependencyTemplate& FrameDependencyTemplate::FrameDiffs(
+    std::initializer_list<int> diffs) {
+  this->frame_diffs.assign(diffs.begin(), diffs.end());
+  return *this;
+}
+inline FrameDependencyTemplate& FrameDependencyTemplate::ChainDiffs(
+    std::initializer_list<int> diffs) {
+  this->chain_diffs.assign(diffs.begin(), diffs.end());
+  return *this;
+}
+
 }  // namespace webrtc
 
 #endif  // API_TRANSPORT_RTP_DEPENDENCY_DESCRIPTOR_H_
diff --git a/call/rtp_video_sender_unittest.cc b/call/rtp_video_sender_unittest.cc
index 6051a35..8a88a24 100644
--- a/call/rtp_video_sender_unittest.cc
+++ b/call/rtp_video_sender_unittest.cc
@@ -705,9 +705,9 @@
   codec_specific.template_structure.emplace();
   codec_specific.template_structure->num_decode_targets = 1;
   codec_specific.template_structure->templates = {
-      GenericFrameInfo::Builder().T(0).Dtis("S").Build(),
-      GenericFrameInfo::Builder().T(0).Dtis("S").Fdiffs({2}).Build(),
-      GenericFrameInfo::Builder().T(1).Dtis("D").Fdiffs({1}).Build(),
+      FrameDependencyTemplate().T(0).Dtis("S"),
+      FrameDependencyTemplate().T(0).Dtis("S").FrameDiffs({2}),
+      FrameDependencyTemplate().T(1).Dtis("D").FrameDiffs({1}),
   };
 
   // Send two tiny images, mapping to single RTP packets.
@@ -769,9 +769,9 @@
   codec_specific.template_structure.emplace();
   codec_specific.template_structure->num_decode_targets = 1;
   codec_specific.template_structure->templates = {
-      GenericFrameInfo::Builder().T(0).Dtis("S").Build(),
-      GenericFrameInfo::Builder().T(0).Dtis("S").Fdiffs({2}).Build(),
-      GenericFrameInfo::Builder().T(1).Dtis("D").Fdiffs({1}).Build(),
+      FrameDependencyTemplate().T(0).Dtis("S"),
+      FrameDependencyTemplate().T(0).Dtis("S").FrameDiffs({2}),
+      FrameDependencyTemplate().T(1).Dtis("D").FrameDiffs({1}),
   };
 
   // Send two tiny images, mapping to single RTP packets.
diff --git a/common_video/generic_frame_descriptor/generic_frame_info.cc b/common_video/generic_frame_descriptor/generic_frame_info.cc
index ef78fac..af66bba 100644
--- a/common_video/generic_frame_descriptor/generic_frame_info.cc
+++ b/common_video/generic_frame_descriptor/generic_frame_info.cc
@@ -15,33 +15,6 @@
 
 namespace webrtc {
 
-absl::InlinedVector<DecodeTargetIndication, 10>
-GenericFrameInfo::DecodeTargetInfo(absl::string_view indication_symbols) {
-  absl::InlinedVector<DecodeTargetIndication, 10> decode_targets;
-  for (char symbol : indication_symbols) {
-    DecodeTargetIndication indication;
-    switch (symbol) {
-      case '-':
-        indication = DecodeTargetIndication::kNotPresent;
-        break;
-      case 'D':
-        indication = DecodeTargetIndication::kDiscardable;
-        break;
-      case 'R':
-        indication = DecodeTargetIndication::kRequired;
-        break;
-      case 'S':
-        indication = DecodeTargetIndication::kSwitch;
-        break;
-      default:
-        RTC_NOTREACHED();
-    }
-    decode_targets.push_back(indication);
-  }
-
-  return decode_targets;
-}
-
 GenericFrameInfo::GenericFrameInfo() = default;
 GenericFrameInfo::GenericFrameInfo(const GenericFrameInfo&) = default;
 GenericFrameInfo::~GenericFrameInfo() = default;
@@ -65,19 +38,8 @@
 
 GenericFrameInfo::Builder& GenericFrameInfo::Builder::Dtis(
     absl::string_view indication_symbols) {
-  info_.decode_target_indications = DecodeTargetInfo(indication_symbols);
-  return *this;
-}
-
-GenericFrameInfo::Builder& GenericFrameInfo::Builder::Fdiffs(
-    std::initializer_list<int> frame_diffs) {
-  info_.frame_diffs.assign(frame_diffs.begin(), frame_diffs.end());
-  return *this;
-}
-
-GenericFrameInfo::Builder& GenericFrameInfo::Builder::ChainDiffs(
-    std::initializer_list<int> chain_diffs) {
-  info_.chain_diffs.assign(chain_diffs.begin(), chain_diffs.end());
+  info_.decode_target_indications =
+      webrtc_impl::StringToDecodeTargetIndications(indication_symbols);
   return *this;
 }
 
diff --git a/common_video/generic_frame_descriptor/generic_frame_info.h b/common_video/generic_frame_descriptor/generic_frame_info.h
index 7ac3665..3a570a6 100644
--- a/common_video/generic_frame_descriptor/generic_frame_info.h
+++ b/common_video/generic_frame_descriptor/generic_frame_info.h
@@ -32,9 +32,6 @@
 };
 
 struct GenericFrameInfo : public FrameDependencyTemplate {
-  static absl::InlinedVector<DecodeTargetIndication, 10> DecodeTargetInfo(
-      absl::string_view indication_symbols);
-
   class Builder;
 
   GenericFrameInfo();
@@ -54,8 +51,6 @@
   Builder& T(int temporal_id);
   Builder& S(int spatial_id);
   Builder& Dtis(absl::string_view indication_symbols);
-  Builder& Fdiffs(std::initializer_list<int> frame_diffs);
-  Builder& ChainDiffs(std::initializer_list<int> chain_diffs);
 
  private:
   GenericFrameInfo info_;
diff --git a/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension_unittest.cc b/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension_unittest.cc
index 244bef8..34d8270 100644
--- a/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension_unittest.cc
@@ -26,11 +26,8 @@
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 2;
-  structure.templates = {GenericFrameInfo::Builder()
-                             .Dtis("SR")
-                             .Fdiffs({1})
-                             .ChainDiffs({2, 2})
-                             .Build()};
+  structure.templates = {
+      FrameDependencyTemplate().Dtis("SR").FrameDiffs({1}).ChainDiffs({2, 2})};
   DependencyDescriptor descriptor;
   descriptor.frame_dependencies = structure.templates[0];
 
@@ -46,11 +43,8 @@
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 2;
-  structure.templates = {GenericFrameInfo::Builder()
-                             .Dtis("SR")
-                             .Fdiffs({1})
-                             .ChainDiffs({1, 1})
-                             .Build()};
+  structure.templates = {
+      FrameDependencyTemplate().Dtis("SR").FrameDiffs({1}).ChainDiffs({1, 1})};
   DependencyDescriptor descriptor;
   descriptor.frame_dependencies = structure.templates[0];
   descriptor.frame_dependencies.frame_diffs = {2};
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc
index 4dd880a..29e4862 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc
@@ -548,9 +548,9 @@
   FrameDependencyStructure video_structure;
   video_structure.num_decode_targets = 2;
   video_structure.templates = {
-      GenericFrameInfo::Builder().S(0).T(0).Dtis("SS").Build(),
-      GenericFrameInfo::Builder().S(1).T(0).Dtis("-S").Build(),
-      GenericFrameInfo::Builder().S(1).T(1).Dtis("-D").Build(),
+      FrameDependencyTemplate().S(0).T(0).Dtis("SS"),
+      FrameDependencyTemplate().S(1).T(0).Dtis("-S"),
+      FrameDependencyTemplate().S(1).T(1).Dtis("-D"),
   };
   rtp_sender_video_.SetVideoStructure(&video_structure);
 
@@ -619,7 +619,7 @@
   // First decode target is protected by the only chain, second one - is not.
   video_structure.decode_target_protected_by_chain = {0, 1};
   video_structure.templates = {
-      GenericFrameInfo::Builder().S(0).T(0).Dtis("SS").ChainDiffs({1}).Build(),
+      FrameDependencyTemplate().S(0).T(0).Dtis("SS").ChainDiffs({1}),
   };
   rtp_sender_video_.SetVideoStructure(&video_structure);
 
@@ -651,14 +651,14 @@
   FrameDependencyStructure video_structure1;
   video_structure1.num_decode_targets = 2;
   video_structure1.templates = {
-      GenericFrameInfo::Builder().S(0).T(0).Dtis("SS").Build(),
-      GenericFrameInfo::Builder().S(0).T(1).Dtis("D-").Build(),
+      FrameDependencyTemplate().S(0).T(0).Dtis("SS"),
+      FrameDependencyTemplate().S(0).T(1).Dtis("D-"),
   };
   FrameDependencyStructure video_structure2;
   video_structure2.num_decode_targets = 2;
   video_structure2.templates = {
-      GenericFrameInfo::Builder().S(0).T(0).Dtis("SS").Build(),
-      GenericFrameInfo::Builder().S(0).T(1).Dtis("R-").Build(),
+      FrameDependencyTemplate().S(0).T(0).Dtis("SS"),
+      FrameDependencyTemplate().S(0).T(1).Dtis("R-"),
   };
 
   // Send 1st key frame.
@@ -741,7 +741,7 @@
 
   FrameDependencyStructure video_structure;
   video_structure.num_decode_targets = 1;
-  video_structure.templates = {GenericFrameInfo::Builder().Dtis("S").Build()};
+  video_structure.templates = {FrameDependencyTemplate().Dtis("S")};
   rtp_sender_video.SetVideoStructure(&video_structure);
 
   // Send key frame.
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l1t2.cc b/modules/video_coding/codecs/av1/scalability_structure_l1t2.cc
index c8386ef..b38a616 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l1t2.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l1t2.cc
@@ -43,16 +43,14 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL1T2::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 1;
   structure.decode_target_protected_by_chain = {0, 0};
-  structure.templates = {
-      Builder().T(0).Dtis("SS").ChainDiffs({0}).Build(),
-      Builder().T(0).Dtis("SS").ChainDiffs({2}).Fdiffs({2}).Build(),
-      Builder().T(1).Dtis("-D").ChainDiffs({1}).Fdiffs({1}).Build(),
-  };
+  structure.templates.resize(3);
+  structure.templates[0].T(0).Dtis("SS").ChainDiffs({0});
+  structure.templates[1].T(0).Dtis("SS").ChainDiffs({2}).FrameDiffs({2});
+  structure.templates[2].T(1).Dtis("-D").ChainDiffs({1}).FrameDiffs({1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l1t3.cc b/modules/video_coding/codecs/av1/scalability_structure_l1t3.cc
index 4ef5628..a04a426 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l1t3.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l1t3.cc
@@ -43,18 +43,16 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL1T3::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 3;
   structure.num_chains = 1;
   structure.decode_target_protected_by_chain = {0, 0, 0};
-  structure.templates = {
-      Builder().T(0).Dtis("SSS").ChainDiffs({0}).Build(),
-      Builder().T(0).Dtis("SSS").ChainDiffs({4}).Fdiffs({4}).Build(),
-      Builder().T(1).Dtis("-DS").ChainDiffs({2}).Fdiffs({2}).Build(),
-      Builder().T(2).Dtis("--D").ChainDiffs({1}).Fdiffs({1}).Build(),
-      Builder().T(2).Dtis("--D").ChainDiffs({3}).Fdiffs({1}).Build(),
-  };
+  structure.templates.resize(5);
+  structure.templates[0].T(0).Dtis("SSS").ChainDiffs({0});
+  structure.templates[1].T(0).Dtis("SSS").ChainDiffs({4}).FrameDiffs({4});
+  structure.templates[2].T(1).Dtis("-DS").ChainDiffs({2}).FrameDiffs({2});
+  structure.templates[3].T(2).Dtis("--D").ChainDiffs({1}).FrameDiffs({1});
+  structure.templates[4].T(2).Dtis("--D").ChainDiffs({3}).FrameDiffs({1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l2t1.cc b/modules/video_coding/codecs/av1/scalability_structure_l2t1.cc
index f3e7583..c3cee19 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l2t1.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l2t1.cc
@@ -44,17 +44,15 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL2T1::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 1};
-  structure.templates = {
-      Builder().S(0).Dtis("SR").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(0).Dtis("SS").ChainDiffs({0, 0}).Build(),
-      Builder().S(1).Dtis("-R").Fdiffs({2, 1}).ChainDiffs({1, 1}).Build(),
-      Builder().S(1).Dtis("-S").Fdiffs({1}).ChainDiffs({1, 1}).Build(),
-  };
+  structure.templates.resize(4);
+  structure.templates[0].S(0).Dtis("SR").ChainDiffs({2, 1}).FrameDiffs({2});
+  structure.templates[1].S(0).Dtis("SS").ChainDiffs({0, 0});
+  structure.templates[2].S(1).Dtis("-R").ChainDiffs({1, 1}).FrameDiffs({2, 1});
+  structure.templates[3].S(1).Dtis("-S").ChainDiffs({1, 1}).FrameDiffs({1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l2t1_key.cc b/modules/video_coding/codecs/av1/scalability_structure_l2t1_key.cc
index 74761be..7e273d1 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l2t1_key.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l2t1_key.cc
@@ -43,17 +43,15 @@
 
 FrameDependencyStructure ScalabilityStructureL2T1Key::DependencyStructure()
     const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 1};
-  structure.templates = {
-      Builder().S(0).Dtis("S-").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(0).Dtis("SS").ChainDiffs({0, 0}).Build(),
-      Builder().S(1).Dtis("-S").Fdiffs({2}).ChainDiffs({1, 2}).Build(),
-      Builder().S(1).Dtis("-S").Fdiffs({1}).ChainDiffs({1, 1}).Build(),
-  };
+  structure.templates.resize(4);
+  structure.templates[0].S(0).Dtis("S-").ChainDiffs({2, 1}).FrameDiffs({2});
+  structure.templates[1].S(0).Dtis("SS").ChainDiffs({0, 0});
+  structure.templates[2].S(1).Dtis("-S").ChainDiffs({1, 2}).FrameDiffs({2});
+  structure.templates[3].S(1).Dtis("-S").ChainDiffs({1, 1}).FrameDiffs({1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l2t2.cc b/modules/video_coding/codecs/av1/scalability_structure_l2t2.cc
index 798e4d5..5db2fad 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l2t2.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l2t2.cc
@@ -48,31 +48,18 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL2T2::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 4;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 0, 1, 1};
-  structure.templates = {
-      Builder().S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0}).Build(),
-      Builder().S(0).T(0).Dtis("SSRR").Fdiffs({4}).ChainDiffs({4, 3}).Build(),
-      Builder().S(0).T(1).Dtis("-D-R").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(1).T(0).Dtis("--SS").Fdiffs({1}).ChainDiffs({1, 1}).Build(),
-      Builder()
-          .S(1)
-          .T(0)
-          .Dtis("--SS")
-          .Fdiffs({4, 1})
-          .ChainDiffs({1, 1})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(1)
-          .Dtis("---D")
-          .Fdiffs({2, 1})
-          .ChainDiffs({3, 2})
-          .Build(),
-  };
+  structure.templates.resize(6);
+  auto& templates = structure.templates;
+  templates[0].S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0});
+  templates[1].S(0).T(0).Dtis("SSRR").ChainDiffs({4, 3}).FrameDiffs({4});
+  templates[2].S(0).T(1).Dtis("-D-R").ChainDiffs({2, 1}).FrameDiffs({2});
+  templates[3].S(1).T(0).Dtis("--SS").ChainDiffs({1, 1}).FrameDiffs({1});
+  templates[4].S(1).T(0).Dtis("--SS").ChainDiffs({1, 1}).FrameDiffs({4, 1});
+  templates[5].S(1).T(1).Dtis("---D").ChainDiffs({3, 2}).FrameDiffs({2, 1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l2t2_key.cc b/modules/video_coding/codecs/av1/scalability_structure_l2t2_key.cc
index e42f8fc..7409070 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l2t2_key.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l2t2_key.cc
@@ -48,19 +48,18 @@
 
 FrameDependencyStructure ScalabilityStructureL2T2Key::DependencyStructure()
     const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 4;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 0, 1, 1};
-  structure.templates = {
-      Builder().S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0}).Build(),
-      Builder().S(0).T(0).Dtis("SS--").Fdiffs({4}).ChainDiffs({4, 3}).Build(),
-      Builder().S(0).T(1).Dtis("-D--").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(1).T(0).Dtis("--SS").Fdiffs({1}).ChainDiffs({1, 1}).Build(),
-      Builder().S(1).T(0).Dtis("--SS").Fdiffs({4}).ChainDiffs({1, 4}).Build(),
-      Builder().S(1).T(1).Dtis("---D").Fdiffs({2}).ChainDiffs({3, 2}).Build(),
-  };
+  structure.templates.resize(6);
+  auto& templates = structure.templates;
+  templates[0].S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0});
+  templates[1].S(0).T(0).Dtis("SS--").ChainDiffs({4, 3}).FrameDiffs({4});
+  templates[2].S(0).T(1).Dtis("-D--").ChainDiffs({2, 1}).FrameDiffs({2});
+  templates[3].S(1).T(0).Dtis("--SS").ChainDiffs({1, 1}).FrameDiffs({1});
+  templates[4].S(1).T(0).Dtis("--SS").ChainDiffs({1, 4}).FrameDiffs({4});
+  templates[5].S(1).T(1).Dtis("---D").ChainDiffs({3, 2}).FrameDiffs({2});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l2t2_key_shift.cc b/modules/video_coding/codecs/av1/scalability_structure_l2t2_key_shift.cc
index 6d19151..6b79332 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l2t2_key_shift.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l2t2_key_shift.cc
@@ -24,7 +24,6 @@
 constexpr auto kDiscardable = DecodeTargetIndication::kDiscardable;
 constexpr auto kSwitch = DecodeTargetIndication::kSwitch;
 
-// decode targets: S0T0, S0T1, S1T0, S1T1
 constexpr DecodeTargetIndication kDtis[6][4] = {
     {kSwitch, kSwitch, kSwitch, kSwitch},                   //    kKey, S0T0
     {kNotPresent, kNotPresent, kSwitch, kSwitch},           //    kKey, S1T0
@@ -48,20 +47,19 @@
 
 FrameDependencyStructure ScalabilityStructureL2T2KeyShift::DependencyStructure()
     const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 4;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 0, 1, 1};
-  structure.templates = {
-      Builder().S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0}).Build(),
-      Builder().S(0).T(0).Dtis("SS--").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(0).T(0).Dtis("SS--").Fdiffs({4}).ChainDiffs({4, 1}).Build(),
-      Builder().S(0).T(1).Dtis("-D--").Fdiffs({2}).ChainDiffs({2, 3}).Build(),
-      Builder().S(1).T(0).Dtis("--SS").Fdiffs({1}).ChainDiffs({1, 1}).Build(),
-      Builder().S(1).T(0).Dtis("--SS").Fdiffs({4}).ChainDiffs({3, 4}).Build(),
-      Builder().S(1).T(1).Dtis("---D").Fdiffs({2}).ChainDiffs({1, 2}).Build(),
-  };
+  structure.templates.resize(7);
+  auto& templates = structure.templates;
+  templates[0].S(0).T(0).Dtis("SSSS").ChainDiffs({0, 0});
+  templates[1].S(0).T(0).Dtis("SS--").ChainDiffs({2, 1}).FrameDiffs({2});
+  templates[2].S(0).T(0).Dtis("SS--").ChainDiffs({4, 1}).FrameDiffs({4});
+  templates[3].S(0).T(1).Dtis("-D--").ChainDiffs({2, 3}).FrameDiffs({2});
+  templates[4].S(1).T(0).Dtis("--SS").ChainDiffs({1, 1}).FrameDiffs({1});
+  templates[5].S(1).T(0).Dtis("--SS").ChainDiffs({3, 4}).FrameDiffs({4});
+  templates[6].S(1).T(1).Dtis("---D").ChainDiffs({1, 2}).FrameDiffs({2});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l3t1.cc b/modules/video_coding/codecs/av1/scalability_structure_l3t1.cc
index b151641..1dd729c 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l3t1.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l3t1.cc
@@ -45,19 +45,18 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL3T1::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 3;
   structure.num_chains = 3;
   structure.decode_target_protected_by_chain = {0, 1, 2};
-  structure.templates = {
-      Builder().S(0).Dtis("SRR").ChainDiffs({3, 2, 1}).Fdiffs({3}).Build(),
-      Builder().S(0).Dtis("SSS").ChainDiffs({0, 0, 0}).Build(),
-      Builder().S(1).Dtis("-SR").ChainDiffs({1, 1, 1}).Fdiffs({3, 1}).Build(),
-      Builder().S(1).Dtis("-SS").ChainDiffs({1, 1, 1}).Fdiffs({1}).Build(),
-      Builder().S(2).Dtis("--S").ChainDiffs({2, 1, 1}).Fdiffs({3, 1}).Build(),
-      Builder().S(2).Dtis("--S").ChainDiffs({2, 1, 1}).Fdiffs({1}).Build(),
-  };
+  auto& templates = structure.templates;
+  templates.resize(6);
+  templates[0].S(0).Dtis("SRR").ChainDiffs({3, 2, 1}).FrameDiffs({3});
+  templates[1].S(0).Dtis("SSS").ChainDiffs({0, 0, 0});
+  templates[2].S(1).Dtis("-SR").ChainDiffs({1, 1, 1}).FrameDiffs({3, 1});
+  templates[3].S(1).Dtis("-SS").ChainDiffs({1, 1, 1}).FrameDiffs({1});
+  templates[4].S(2).Dtis("--S").ChainDiffs({2, 1, 1}).FrameDiffs({3, 1});
+  templates[5].S(2).Dtis("--S").ChainDiffs({2, 1, 1}).FrameDiffs({1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_l3t3.cc b/modules/video_coding/codecs/av1/scalability_structure_l3t3.cc
index 62c52fc..6ac75da 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_l3t3.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_l3t3.cc
@@ -89,112 +89,31 @@
 }
 
 FrameDependencyStructure ScalabilityStructureL3T3::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 9;
   structure.num_chains = 3;
   structure.decode_target_protected_by_chain = {0, 0, 0, 1, 1, 1, 2, 2, 2};
-  structure.templates = {
-      Builder().S(0).T(0).Dtis("SSSSSSSSS").ChainDiffs({0, 0, 0}).Build(),
-      Builder()
-          .S(0)
-          .T(0)
-          .Dtis("SSSRRRRRR")
-          .Fdiffs({12})
-          .ChainDiffs({12, 11, 10})
-          .Build(),
-      Builder()
-          .S(0)
-          .T(1)
-          .Dtis("-DS-RR-RR")
-          .Fdiffs({6})
-          .ChainDiffs({6, 5, 4})
-          .Build(),
-      Builder()
-          .S(0)
-          .T(2)
-          .Dtis("--D--R--R")
-          .Fdiffs({3})
-          .ChainDiffs({3, 2, 1})
-          .Build(),
-      Builder()
-          .S(0)
-          .T(2)
-          .Dtis("--D--R--R")
-          .Fdiffs({3})
-          .ChainDiffs({9, 8, 7})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(0)
-          .Dtis("---SSSSSS")
-          .Fdiffs({1})
-          .ChainDiffs({1, 1, 1})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(0)
-          .Dtis("---SSSRRR")
-          .Fdiffs({12, 1})
-          .ChainDiffs({1, 1, 1})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(1)
-          .Dtis("----DS-RR")
-          .Fdiffs({6, 1})
-          .ChainDiffs({7, 6, 5})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(2)
-          .Dtis("-----D--R")
-          .Fdiffs({3, 1})
-          .ChainDiffs({4, 3, 2})
-          .Build(),
-      Builder()
-          .S(1)
-          .T(2)
-          .Dtis("-----D--R")
-          .Fdiffs({3, 1})
-          .ChainDiffs({10, 9, 8})
-          .Build(),
-      Builder()
-          .S(2)
-          .T(0)
-          .Dtis("------SSS")
-          .Fdiffs({1})
-          .ChainDiffs({2, 1, 1})
-          .Build(),
-      Builder()
-          .S(2)
-          .T(0)
-          .Dtis("------SSS")
-          .Fdiffs({12, 1})
-          .ChainDiffs({2, 1, 1})
-          .Build(),
-      Builder()
-          .S(2)
-          .T(1)
-          .Dtis("-------DS")
-          .Fdiffs({6, 1})
-          .ChainDiffs({8, 7, 6})
-          .Build(),
-      Builder()
-          .S(2)
-          .T(2)
-          .Dtis("--------D")
-          .Fdiffs({3, 1})
-          .ChainDiffs({5, 4, 3})
-          .Build(),
-      Builder()
-          .S(2)
-          .T(2)
-          .Dtis("--------D")
-          .Fdiffs({3, 1})
-          .ChainDiffs({11, 10, 9})
-          .Build(),
-  };
+  auto& t = structure.templates;
+  t.resize(15);
+  // Templates are shown in the order frames following them appear in the
+  // stream, but in `structure.templates` array templates are sorted by
+  // (`spatial_id`, `temporal_id`) since that is a dependency descriptor
+  // requirement. Indexes are written in hex for nicer alignment.
+  t[0x1].S(0).T(0).Dtis("SSSSSSSSS").ChainDiffs({0, 0, 0});
+  t[0x6].S(1).T(0).Dtis("---SSSSSS").ChainDiffs({1, 1, 1}).FrameDiffs({1});
+  t[0xB].S(2).T(0).Dtis("------SSS").ChainDiffs({2, 1, 1}).FrameDiffs({1});
+  t[0x3].S(0).T(2).Dtis("--D--R--R").ChainDiffs({3, 2, 1}).FrameDiffs({3});
+  t[0x8].S(1).T(2).Dtis("-----D--R").ChainDiffs({4, 3, 2}).FrameDiffs({3, 1});
+  t[0xD].S(2).T(2).Dtis("--------D").ChainDiffs({5, 4, 3}).FrameDiffs({3, 1});
+  t[0x2].S(0).T(1).Dtis("-DS-RR-RR").ChainDiffs({6, 5, 4}).FrameDiffs({6});
+  t[0x7].S(1).T(1).Dtis("----DS-RR").ChainDiffs({7, 6, 5}).FrameDiffs({6, 1});
+  t[0xC].S(2).T(1).Dtis("-------DS").ChainDiffs({8, 7, 6}).FrameDiffs({6, 1});
+  t[0x4].S(0).T(2).Dtis("--D--R--R").ChainDiffs({9, 8, 7}).FrameDiffs({3});
+  t[0x9].S(1).T(2).Dtis("-----D--R").ChainDiffs({10, 9, 8}).FrameDiffs({3, 1});
+  t[0xE].S(2).T(2).Dtis("--------D").ChainDiffs({11, 10, 9}).FrameDiffs({3, 1});
+  t[0x0].S(0).T(0).Dtis("SSSRRRRRR").ChainDiffs({12, 11, 10}).FrameDiffs({12});
+  t[0x5].S(1).T(0).Dtis("---SSSRRR").ChainDiffs({1, 1, 1}).FrameDiffs({12, 1});
+  t[0xA].S(2).T(0).Dtis("------SSS").ChainDiffs({2, 1, 1}).FrameDiffs({12, 1});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/av1/scalability_structure_s2t1.cc b/modules/video_coding/codecs/av1/scalability_structure_s2t1.cc
index 067e3f3..267363f 100644
--- a/modules/video_coding/codecs/av1/scalability_structure_s2t1.cc
+++ b/modules/video_coding/codecs/av1/scalability_structure_s2t1.cc
@@ -41,17 +41,15 @@
 }
 
 FrameDependencyStructure ScalabilityStructureS2T1::DependencyStructure() const {
-  using Builder = GenericFrameInfo::Builder;
   FrameDependencyStructure structure;
   structure.num_decode_targets = 2;
   structure.num_chains = 2;
   structure.decode_target_protected_by_chain = {0, 1};
-  structure.templates = {
-      Builder().S(0).Dtis("S-").Fdiffs({2}).ChainDiffs({2, 1}).Build(),
-      Builder().S(0).Dtis("S-").ChainDiffs({0, 0}).Build(),
-      Builder().S(1).Dtis("-S").Fdiffs({2}).ChainDiffs({1, 2}).Build(),
-      Builder().S(1).Dtis("-S").ChainDiffs({1, 0}).Build(),
-  };
+  structure.templates.resize(4);
+  structure.templates[0].S(0).Dtis("S-").ChainDiffs({2, 1}).FrameDiffs({2});
+  structure.templates[1].S(0).Dtis("S-").ChainDiffs({0, 0});
+  structure.templates[2].S(1).Dtis("-S").ChainDiffs({1, 2}).FrameDiffs({2});
+  structure.templates[3].S(1).Dtis("-S").ChainDiffs({1, 0});
   return structure;
 }
 
diff --git a/modules/video_coding/codecs/vp8/default_temporal_layers.cc b/modules/video_coding/codecs/vp8/default_temporal_layers.cc
index 83ea450..b565259 100644
--- a/modules/video_coding/codecs/vp8/default_temporal_layers.cc
+++ b/modules/video_coding/codecs/vp8/default_temporal_layers.cc
@@ -608,58 +608,52 @@
   FrameDependencyStructure template_structure;
   template_structure.num_decode_targets = num_layers;
 
-  using Builder = GenericFrameInfo::Builder;
   switch (num_layers) {
     case 1: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("S").Build(),
-          Builder().T(0).Dtis("S").Fdiffs({1}).Build(),
-      };
+      template_structure.templates.resize(2);
+      template_structure.templates[0].T(0).Dtis("S");
+      template_structure.templates[1].T(0).Dtis("S").FrameDiffs({1});
       return template_structure;
     }
     case 2: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("SS").Build(),
-          Builder().T(0).Dtis("SS").Fdiffs({2}).Build(),
-          Builder().T(0).Dtis("SR").Fdiffs({2}).Build(),
-          Builder().T(1).Dtis("-S").Fdiffs({1}).Build(),
-          Builder().T(1).Dtis("-D").Fdiffs({1, 2}).Build(),
-      };
+      template_structure.templates.resize(5);
+      template_structure.templates[0].T(0).Dtis("SS");
+      template_structure.templates[1].T(0).Dtis("SS").FrameDiffs({2});
+      template_structure.templates[2].T(0).Dtis("SR").FrameDiffs({2});
+      template_structure.templates[3].T(1).Dtis("-S").FrameDiffs({1});
+      template_structure.templates[4].T(1).Dtis("-D").FrameDiffs({2, 1});
       return template_structure;
     }
     case 3: {
       if (field_trial::IsEnabled("WebRTC-UseShortVP8TL3Pattern")) {
-        template_structure.templates = {
-            Builder().T(0).Dtis("SSS").Build(),
-            Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
-            Builder().T(1).Dtis("-DR").Fdiffs({2}).Build(),
-            Builder().T(2).Dtis("--S").Fdiffs({1}).Build(),
-            Builder().T(2).Dtis("--D").Fdiffs({1, 2}).Build(),
-        };
+        template_structure.templates.resize(5);
+        template_structure.templates[0].T(0).Dtis("SSS");
+        template_structure.templates[1].T(0).Dtis("SSS").FrameDiffs({4});
+        template_structure.templates[2].T(1).Dtis("-DR").FrameDiffs({2});
+        template_structure.templates[3].T(2).Dtis("--S").FrameDiffs({1});
+        template_structure.templates[4].T(2).Dtis("--D").FrameDiffs({2, 1});
       } else {
-        template_structure.templates = {
-            Builder().T(0).Dtis("SSS").Build(),
-            Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
-            Builder().T(0).Dtis("SRR").Fdiffs({4}).Build(),
-            Builder().T(1).Dtis("-SS").Fdiffs({2}).Build(),
-            Builder().T(1).Dtis("-DS").Fdiffs({2, 4}).Build(),
-            Builder().T(2).Dtis("--D").Fdiffs({1}).Build(),
-            Builder().T(2).Dtis("--D").Fdiffs({1, 3}).Build(),
-        };
+        template_structure.templates.resize(7);
+        template_structure.templates[0].T(0).Dtis("SSS");
+        template_structure.templates[1].T(0).Dtis("SSS").FrameDiffs({4});
+        template_structure.templates[2].T(0).Dtis("SRR").FrameDiffs({4});
+        template_structure.templates[3].T(1).Dtis("-SS").FrameDiffs({2});
+        template_structure.templates[4].T(1).Dtis("-DS").FrameDiffs({4, 2});
+        template_structure.templates[5].T(2).Dtis("--D").FrameDiffs({1});
+        template_structure.templates[6].T(2).Dtis("--D").FrameDiffs({3, 1});
       }
       return template_structure;
     }
     case 4: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("SSSS").Build(),
-          Builder().T(0).Dtis("SSSS").Fdiffs({8}).Build(),
-          Builder().T(1).Dtis("-SRR").Fdiffs({4}).Build(),
-          Builder().T(1).Dtis("-SRR").Fdiffs({4, 8}).Build(),
-          Builder().T(2).Dtis("--SR").Fdiffs({2}).Build(),
-          Builder().T(2).Dtis("--SR").Fdiffs({2, 4}).Build(),
-          Builder().T(3).Dtis("---D").Fdiffs({1}).Build(),
-          Builder().T(3).Dtis("---D").Fdiffs({1, 3}).Build(),
-      };
+      template_structure.templates.resize(8);
+      template_structure.templates[0].T(0).Dtis("SSSS");
+      template_structure.templates[1].T(0).Dtis("SSSS").FrameDiffs({8});
+      template_structure.templates[2].T(1).Dtis("-SRR").FrameDiffs({4});
+      template_structure.templates[3].T(1).Dtis("-SRR").FrameDiffs({4, 8});
+      template_structure.templates[4].T(2).Dtis("--SR").FrameDiffs({2});
+      template_structure.templates[5].T(2).Dtis("--SR").FrameDiffs({2, 4});
+      template_structure.templates[6].T(3).Dtis("---D").FrameDiffs({1});
+      template_structure.templates[7].T(3).Dtis("---D").FrameDiffs({1, 3});
       return template_structure;
     }
     default:
diff --git a/modules/video_coding/codecs/vp8/default_temporal_layers.h b/modules/video_coding/codecs/vp8/default_temporal_layers.h
index 29cfcf0..d127d80 100644
--- a/modules/video_coding/codecs/vp8/default_temporal_layers.h
+++ b/modules/video_coding/codecs/vp8/default_temporal_layers.h
@@ -75,7 +75,7 @@
     DependencyInfo(absl::string_view indication_symbols,
                    Vp8FrameConfig frame_config)
         : decode_target_indications(
-              GenericFrameInfo::DecodeTargetInfo(indication_symbols)),
+              webrtc_impl::StringToDecodeTargetIndications(indication_symbols)),
           frame_config(frame_config) {}
 
     absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
diff --git a/modules/video_coding/codecs/vp8/screenshare_layers.cc b/modules/video_coding/codecs/vp8/screenshare_layers.cc
index 01858c6..caccb42 100644
--- a/modules/video_coding/codecs/vp8/screenshare_layers.cc
+++ b/modules/video_coding/codecs/vp8/screenshare_layers.cc
@@ -36,6 +36,7 @@
 constexpr int kMaxTimeBetweenSyncs = kOneSecond90Khz * 4;
 constexpr int kQpDeltaThresholdForSync = 8;
 constexpr int kMinBitrateKbpsForQpBoost = 500;
+constexpr auto kSwitch = DecodeTargetIndication::kSwitch;
 }  // namespace
 
 const double ScreenshareLayers::kMaxTL0FpsReduction = 2.5;
@@ -319,8 +320,7 @@
   if (number_of_temporal_layers_ == 1) {
     vp8_info.temporalIdx = kNoTemporalIdx;
     vp8_info.layerSync = false;
-    generic_frame_info.decode_target_indications =
-        GenericFrameInfo::DecodeTargetInfo("S");
+    generic_frame_info.decode_target_indications = {kSwitch};
     generic_frame_info.encoder_buffers.emplace_back(
         0, /*referenced=*/!is_keyframe, /*updated=*/true);
   } else {
@@ -344,8 +344,7 @@
       active_layer_ = 1;
       info->template_structure =
           GetTemplateStructure(number_of_temporal_layers_);
-      generic_frame_info.decode_target_indications =
-          GenericFrameInfo::DecodeTargetInfo("SS");
+      generic_frame_info.decode_target_indications = {kSwitch, kSwitch};
     } else if (active_layer_ >= 0 && layers_[active_layer_].state ==
                                          TemporalLayer::State::kKeyFrame) {
       layers_[active_layer_].state = TemporalLayer::State::kNormal;
@@ -429,21 +428,18 @@
   FrameDependencyStructure template_structure;
   template_structure.num_decode_targets = num_layers;
 
-  using Builder = GenericFrameInfo::Builder;
   switch (num_layers) {
     case 1: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("S").Build(),
-          Builder().T(0).Dtis("S").Fdiffs({1}).Build(),
-      };
+      template_structure.templates.resize(2);
+      template_structure.templates[0].T(0).Dtis("S");
+      template_structure.templates[1].T(0).Dtis("S").FrameDiffs({1});
       return template_structure;
     }
     case 2: {
-      template_structure.templates = {
-          Builder().T(0).Dtis("SS").Build(),
-          Builder().T(0).Dtis("SS").Fdiffs({1}).Build(),
-          Builder().T(1).Dtis("-S").Fdiffs({1}).Build(),
-      };
+      template_structure.templates.resize(3);
+      template_structure.templates[0].T(0).Dtis("SS");
+      template_structure.templates[1].T(0).Dtis("SS").FrameDiffs({1});
+      template_structure.templates[2].T(1).Dtis("-S").FrameDiffs({1});
       return template_structure;
     }
     default:
diff --git a/modules/video_coding/codecs/vp8/screenshare_layers.h b/modules/video_coding/codecs/vp8/screenshare_layers.h
index 5270ffe..39477f1 100644
--- a/modules/video_coding/codecs/vp8/screenshare_layers.h
+++ b/modules/video_coding/codecs/vp8/screenshare_layers.h
@@ -78,7 +78,7 @@
     DependencyInfo(absl::string_view indication_symbols,
                    Vp8FrameConfig frame_config)
         : decode_target_indications(
-              GenericFrameInfo::DecodeTargetInfo(indication_symbols)),
+              webrtc_impl::StringToDecodeTargetIndications(indication_symbols)),
           frame_config(frame_config) {}
 
     absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
diff --git a/video/rtp_video_stream_receiver2_unittest.cc b/video/rtp_video_stream_receiver2_unittest.cc
index 22ca595..cda0fe5 100644
--- a/video/rtp_video_stream_receiver2_unittest.cc
+++ b/video/rtp_video_stream_receiver2_unittest.cc
@@ -970,8 +970,8 @@
     FrameDependencyStructure stream_structure;
     stream_structure.num_decode_targets = 1;
     stream_structure.templates = {
-        GenericFrameInfo::Builder().Dtis("S").Build(),
-        GenericFrameInfo::Builder().Dtis("S").Fdiffs({1}).Build(),
+        FrameDependencyTemplate().Dtis("S"),
+        FrameDependencyTemplate().Dtis("S").FrameDiffs({1}),
     };
     return stream_structure;
   }
diff --git a/video/rtp_video_stream_receiver_unittest.cc b/video/rtp_video_stream_receiver_unittest.cc
index d561ea4..20d6ae8 100644
--- a/video/rtp_video_stream_receiver_unittest.cc
+++ b/video/rtp_video_stream_receiver_unittest.cc
@@ -963,8 +963,8 @@
     FrameDependencyStructure stream_structure;
     stream_structure.num_decode_targets = 1;
     stream_structure.templates = {
-        GenericFrameInfo::Builder().Dtis("S").Build(),
-        GenericFrameInfo::Builder().Dtis("S").Fdiffs({1}).Build(),
+        FrameDependencyTemplate().Dtis("S"),
+        FrameDependencyTemplate().Dtis("S").FrameDiffs({1}),
     };
     return stream_structure;
   }