Move BitrateAllocation to api/ and rename it VideoBitrateAllocation

Since the webrtc_common build target does not have visibility set, we
cannot easily use BitrateAllocation in other parts of Chromium.
This is currently blocking parts of chromium:794608, and I know of other
usage outside webrtc already, so moving it to api/ should be warranted.

Also, since there's some naming confusion and this class is video
specific rename it VideoBitrateAllocation. This also fits with the
standard interface for producing these: VideoBitrateAllocator.

Bug: chromium:794608
Change-Id: I4c0fae40f9365e860c605a76a4f67ecc9b9cf9fe
Reviewed-on: https://webrtc-review.googlesource.com/70783
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22986}
diff --git a/BUILD.gn b/BUILD.gn
index 797467c..1c3d55d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -384,6 +384,7 @@
     ":typedefs",
     "api:array_view",
     "api:optional",
+    "api:video_bitrate_allocation",
     "rtc_base:checks",
     "rtc_base:deprecation",
     "rtc_base:stringutils",
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 7690624..94ed84e 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -343,6 +343,21 @@
   ]
 }
 
+rtc_source_set("video_bitrate_allocation") {
+  visibility = [ "*" ]
+  sources = [
+    "video/video_bitrate_allocation.cc",
+    "video/video_bitrate_allocation.h",
+  ]
+  deps = [
+    ":optional",
+    "..:typedefs",
+    "../rtc_base:checks",
+    "../rtc_base:safe_conversions",
+    "../rtc_base:stringutils",
+  ]
+}
+
 if (rtc_include_tests) {
   if (rtc_enable_protobuf) {
     rtc_source_set("audioproc_f_api") {
diff --git a/api/video/video_bitrate_allocation.cc b/api/video/video_bitrate_allocation.cc
new file mode 100644
index 0000000..059eb8f
--- /dev/null
+++ b/api/video/video_bitrate_allocation.cc
@@ -0,0 +1,168 @@
+/*
+ *  Copyright (c) 2018 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/video/video_bitrate_allocation.h"
+
+#include <limits>
+
+#include "rtc_base/checks.h"
+#include "rtc_base/numerics/safe_conversions.h"
+#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/stringutils.h"
+
+namespace webrtc {
+
+VideoBitrateAllocation::VideoBitrateAllocation() : sum_(0) {}
+
+bool VideoBitrateAllocation::SetBitrate(size_t spatial_index,
+                                        size_t temporal_index,
+                                        uint32_t bitrate_bps) {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
+  int64_t new_bitrate_sum_bps = sum_;
+  rtc::Optional<uint32_t>& layer_bitrate =
+      bitrates_[spatial_index][temporal_index];
+  if (layer_bitrate) {
+    RTC_DCHECK_LE(*layer_bitrate, sum_);
+    new_bitrate_sum_bps -= *layer_bitrate;
+  }
+  new_bitrate_sum_bps += bitrate_bps;
+  if (new_bitrate_sum_bps > kMaxBitrateBps)
+    return false;
+
+  layer_bitrate = bitrate_bps;
+  sum_ = rtc::dchecked_cast<uint32_t>(new_bitrate_sum_bps);
+  return true;
+}
+
+bool VideoBitrateAllocation::HasBitrate(size_t spatial_index,
+                                        size_t temporal_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
+  return bitrates_[spatial_index][temporal_index].has_value();
+}
+
+uint32_t VideoBitrateAllocation::GetBitrate(size_t spatial_index,
+                                            size_t temporal_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
+  return bitrates_[spatial_index][temporal_index].value_or(0);
+}
+
+// Whether the specific spatial layers has the bitrate set in any of its
+// temporal layers.
+bool VideoBitrateAllocation::IsSpatialLayerUsed(size_t spatial_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  for (size_t i = 0; i < kMaxTemporalStreams; ++i) {
+    if (bitrates_[spatial_index][i].has_value())
+      return true;
+  }
+  return false;
+}
+
+// Get the sum of all the temporal layer for a specific spatial layer.
+uint32_t VideoBitrateAllocation::GetSpatialLayerSum(
+    size_t spatial_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  return GetTemporalLayerSum(spatial_index, kMaxTemporalStreams - 1);
+}
+
+uint32_t VideoBitrateAllocation::GetTemporalLayerSum(
+    size_t spatial_index,
+    size_t temporal_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
+  uint32_t sum = 0;
+  for (size_t i = 0; i <= temporal_index; ++i) {
+    sum += bitrates_[spatial_index][i].value_or(0);
+  }
+  return sum;
+}
+
+std::vector<uint32_t> VideoBitrateAllocation::GetTemporalLayerAllocation(
+    size_t spatial_index) const {
+  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
+  std::vector<uint32_t> temporal_rates;
+
+  // Find the highest temporal layer with a defined bitrate in order to
+  // determine the size of the temporal layer allocation.
+  for (size_t i = kMaxTemporalStreams; i > 0; --i) {
+    if (bitrates_[spatial_index][i - 1].has_value()) {
+      temporal_rates.resize(i);
+      break;
+    }
+  }
+
+  for (size_t i = 0; i < temporal_rates.size(); ++i) {
+    temporal_rates[i] = bitrates_[spatial_index][i].value_or(0);
+  }
+
+  return temporal_rates;
+}
+
+bool VideoBitrateAllocation::operator==(
+    const VideoBitrateAllocation& other) const {
+  for (size_t si = 0; si < kMaxSpatialLayers; ++si) {
+    for (size_t ti = 0; ti < kMaxTemporalStreams; ++ti) {
+      if (bitrates_[si][ti] != other.bitrates_[si][ti])
+        return false;
+    }
+  }
+  return true;
+}
+
+std::string VideoBitrateAllocation::ToString() const {
+  if (sum_ == 0)
+    return "VideoBitrateAllocation [ [] ]";
+
+  // Max string length in practice is 260, but let's have some overhead and
+  // round up to nearest power of two.
+  char string_buf[512];
+  rtc::SimpleStringBuilder ssb(string_buf);
+
+  ssb << "VideoBitrateAllocation [";
+  uint32_t spatial_cumulator = 0;
+  for (size_t si = 0; si < kMaxSpatialLayers; ++si) {
+    RTC_DCHECK_LE(spatial_cumulator, sum_);
+    if (spatial_cumulator == sum_)
+      break;
+
+    const uint32_t layer_sum = GetSpatialLayerSum(si);
+    if (layer_sum == sum_) {
+      ssb << " [";
+    } else {
+      if (si > 0)
+        ssb << ",";
+      ssb << '\n' << "  [";
+    }
+    spatial_cumulator += layer_sum;
+
+    uint32_t temporal_cumulator = 0;
+    for (size_t ti = 0; ti < kMaxTemporalStreams; ++ti) {
+      RTC_DCHECK_LE(temporal_cumulator, layer_sum);
+      if (temporal_cumulator == layer_sum)
+        break;
+
+      if (ti > 0)
+        ssb << ", ";
+
+      uint32_t bitrate = bitrates_[si][ti].value_or(0);
+      ssb << bitrate;
+      temporal_cumulator += bitrate;
+    }
+    ssb << "]";
+  }
+
+  RTC_DCHECK_EQ(spatial_cumulator, sum_);
+  ssb << " ]";
+  return ssb.str();
+}
+
+}  // namespace webrtc
diff --git a/api/video/video_bitrate_allocation.h b/api/video/video_bitrate_allocation.h
new file mode 100644
index 0000000..b748b67
--- /dev/null
+++ b/api/video/video_bitrate_allocation.h
@@ -0,0 +1,85 @@
+/*
+ *  Copyright (c) 2018 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 API_VIDEO_VIDEO_BITRATE_ALLOCATION_H_
+#define API_VIDEO_VIDEO_BITRATE_ALLOCATION_H_
+
+#include <limits>
+#include <string>
+#include <vector>
+
+#include "api/optional.h"
+#include "typedefs.h"  // NOLINT(build/include)
+
+namespace webrtc {
+
+// TODO(sprang): Move back to common_types when include of this is removed.
+enum : int { kMaxSimulcastStreams = 4 };
+enum : int { kMaxSpatialLayers = 5 };
+enum : int { kMaxTemporalStreams = 4 };
+
+// Class that describes how video bitrate, in bps, is allocated across temporal
+// and spatial layers. Not that bitrates are NOT cumulative. Depending on if
+// layers are dependent or not, it is up to the user to aggregate.
+// For each index, the bitrate can also both set and unset. This is used with a
+// set bps = 0 to signal an explicit "turn off" signal.
+class VideoBitrateAllocation {
+ public:
+  static constexpr uint32_t kMaxBitrateBps =
+      std::numeric_limits<uint32_t>::max();
+  VideoBitrateAllocation();
+
+  bool SetBitrate(size_t spatial_index,
+                  size_t temporal_index,
+                  uint32_t bitrate_bps);
+
+  bool HasBitrate(size_t spatial_index, size_t temporal_index) const;
+
+  uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
+
+  // Whether the specific spatial layers has the bitrate set in any of its
+  // temporal layers.
+  bool IsSpatialLayerUsed(size_t spatial_index) const;
+
+  // Get the sum of all the temporal layer for a specific spatial layer.
+  uint32_t GetSpatialLayerSum(size_t spatial_index) const;
+
+  // Sum of bitrates of temporal layers, from layer 0 to |temporal_index|
+  // inclusive, of specified spatial layer |spatial_index|. Bitrates of lower
+  // spatial layers are not included.
+  uint32_t GetTemporalLayerSum(size_t spatial_index,
+                               size_t temporal_index) const;
+
+  // Returns a vector of the temporal layer bitrates for the specific spatial
+  // layer. Length of the returned vector is cropped to the highest temporal
+  // layer with a defined bitrate.
+  std::vector<uint32_t> GetTemporalLayerAllocation(size_t spatial_index) const;
+
+  uint32_t get_sum_bps() const { return sum_; }  // Sum of all bitrates.
+  uint32_t get_sum_kbps() const {
+    // Round down to not exceed the allocated bitrate.
+    return sum_ / 1000;
+  }
+
+  bool operator==(const VideoBitrateAllocation& other) const;
+  inline bool operator!=(const VideoBitrateAllocation& other) const {
+    return !(*this == other);
+  }
+
+  std::string ToString() const;
+
+ private:
+  uint32_t sum_;
+  rtc::Optional<uint32_t> bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
+};
+
+}  // namespace webrtc
+
+#endif  // API_VIDEO_VIDEO_BITRATE_ALLOCATION_H_
diff --git a/api/video_codecs/video_encoder.cc b/api/video_codecs/video_encoder.cc
index 1abee76..4de6829 100644
--- a/api/video_codecs/video_encoder.cc
+++ b/api/video_codecs/video_encoder.cc
@@ -86,7 +86,7 @@
 }
 
 int32_t VideoEncoder::SetRateAllocation(
-    const BitrateAllocation& allocation,
+    const VideoBitrateAllocation& allocation,
     uint32_t framerate) {
   return SetRates(allocation.get_sum_kbps(), framerate);
 }
diff --git a/api/video_codecs/video_encoder.h b/api/video_codecs/video_encoder.h
index 583c8ac..6218741 100644
--- a/api/video_codecs/video_encoder.h
+++ b/api/video_codecs/video_encoder.h
@@ -197,7 +197,7 @@
 
   // Default fallback: Just use the sum of bitrates as the single target rate.
   // TODO(sprang): Remove this default implementation when we remove SetRates().
-  virtual int32_t SetRateAllocation(const BitrateAllocation& allocation,
+  virtual int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
                                     uint32_t framerate);
 
   // Any encoder implementation wishing to use the WebRTC provided
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 6520e6f..ba48d9a 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -716,7 +716,7 @@
       return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size);
     }
 
-    int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
                               uint32_t framerate) override {
       last_set_bitrate_kbps_ = rate_allocation.get_sum_kbps();
       if (encoder_inits_ == 1 &&
diff --git a/common_types.cc b/common_types.cc
index 5e0dc93..20766cd 100644
--- a/common_types.cc
+++ b/common_types.cc
@@ -174,137 +174,4 @@
   return kVideoCodecGeneric;
 }
 
-const uint32_t BitrateAllocation::kMaxBitrateBps =
-    std::numeric_limits<uint32_t>::max();
-
-BitrateAllocation::BitrateAllocation() : sum_(0), bitrates_{}, has_bitrate_{} {}
-
-bool BitrateAllocation::SetBitrate(size_t spatial_index,
-                                   size_t temporal_index,
-                                   uint32_t bitrate_bps) {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
-  RTC_CHECK_LE(bitrates_[spatial_index][temporal_index], sum_);
-  uint64_t new_bitrate_sum_bps = sum_;
-  new_bitrate_sum_bps -= bitrates_[spatial_index][temporal_index];
-  new_bitrate_sum_bps += bitrate_bps;
-  if (new_bitrate_sum_bps > kMaxBitrateBps)
-    return false;
-
-  bitrates_[spatial_index][temporal_index] = bitrate_bps;
-  has_bitrate_[spatial_index][temporal_index] = true;
-  sum_ = static_cast<uint32_t>(new_bitrate_sum_bps);
-  return true;
-}
-
-bool BitrateAllocation::HasBitrate(size_t spatial_index,
-                                   size_t temporal_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
-  return has_bitrate_[spatial_index][temporal_index];
-}
-
-uint32_t BitrateAllocation::GetBitrate(size_t spatial_index,
-                                       size_t temporal_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
-  return bitrates_[spatial_index][temporal_index];
-}
-
-// Whether the specific spatial layers has the bitrate set in any of its
-// temporal layers.
-bool BitrateAllocation::IsSpatialLayerUsed(size_t spatial_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  for (int i = 0; i < kMaxTemporalStreams; ++i) {
-    if (has_bitrate_[spatial_index][i])
-      return true;
-  }
-  return false;
-}
-
-// Get the sum of all the temporal layer for a specific spatial layer.
-uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  return GetTemporalLayerSum(spatial_index, kMaxTemporalStreams - 1);
-}
-
-uint32_t BitrateAllocation::GetTemporalLayerSum(size_t spatial_index,
-                                                size_t temporal_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
-  uint32_t sum = 0;
-  for (size_t i = 0; i <= temporal_index; ++i) {
-    sum += bitrates_[spatial_index][i];
-  }
-  return sum;
-}
-
-std::vector<uint32_t> BitrateAllocation::GetTemporalLayerAllocation(
-    size_t spatial_index) const {
-  RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
-  std::vector<uint32_t> temporal_rates;
-
-  // Find the highest temporal layer with a defined bitrate in order to
-  // determine the size of the temporal layer allocation.
-  for (size_t i = kMaxTemporalStreams; i > 0; --i) {
-    if (has_bitrate_[spatial_index][i - 1]) {
-      temporal_rates.resize(i);
-      break;
-    }
-  }
-
-  for (size_t i = 0; i < temporal_rates.size(); ++i) {
-    temporal_rates[i] = bitrates_[spatial_index][i];
-  }
-
-  return temporal_rates;
-}
-
-std::string BitrateAllocation::ToString() const {
-  if (sum_ == 0)
-    return "BitrateAllocation [ [] ]";
-
-  // Max string length in practice is 260, but let's have some overhead and
-  // round up to nearest power of two.
-  char string_buf[512];
-  rtc::SimpleStringBuilder ssb(string_buf);
-
-  ssb << "BitrateAllocation [";
-  uint32_t spatial_cumulator = 0;
-  for (int si = 0; si < kMaxSpatialLayers; ++si) {
-    RTC_DCHECK_LE(spatial_cumulator, sum_);
-    if (spatial_cumulator == sum_)
-      break;
-
-    const uint32_t layer_sum = GetSpatialLayerSum(si);
-    if (layer_sum == sum_) {
-      ssb << " [";
-    } else {
-      if (si > 0)
-        ssb << ",";
-      ssb << '\n' << "  [";
-    }
-    spatial_cumulator += layer_sum;
-
-    uint32_t temporal_cumulator = 0;
-    for (int ti = 0; ti < kMaxTemporalStreams; ++ti) {
-      RTC_DCHECK_LE(temporal_cumulator, layer_sum);
-      if (temporal_cumulator == layer_sum)
-        break;
-
-      if (ti > 0)
-        ssb << ", ";
-
-      uint32_t bitrate = bitrates_[si][ti];
-      ssb << bitrate;
-      temporal_cumulator += bitrate;
-    }
-    ssb << "]";
-  }
-
-  RTC_DCHECK_EQ(spatial_cumulator, sum_);
-  ssb << " ]";
-  return ssb.str();
-}
-
 }  // namespace webrtc
diff --git a/common_types.h b/common_types.h
index 140854c..a6ec5f24 100644
--- a/common_types.h
+++ b/common_types.h
@@ -18,6 +18,8 @@
 
 #include "api/array_view.h"
 #include "api/optional.h"
+// TODO(sprang): Remove this include when all usage includes it directly.
+#include "api/video/video_bitrate_allocation.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/deprecation.h"
 #include "typedefs.h"  // NOLINT(build/include)
@@ -338,10 +340,6 @@
 };
 
 // Video codec
-enum { kMaxSimulcastStreams = 4 };
-enum { kMaxSpatialLayers = 5 };
-enum { kMaxTemporalStreams = 4 };
-
 enum VideoCodecComplexity {
   kComplexityNormal = 0,
   kComplexityHigh = 1,
@@ -519,58 +517,8 @@
   VideoCodecUnion codec_specific_;
 };
 
-class BitrateAllocation {
- public:
-  static const uint32_t kMaxBitrateBps;
-  BitrateAllocation();
-
-  bool SetBitrate(size_t spatial_index,
-                  size_t temporal_index,
-                  uint32_t bitrate_bps);
-
-  bool HasBitrate(size_t spatial_index, size_t temporal_index) const;
-
-  uint32_t GetBitrate(size_t spatial_index, size_t temporal_index) const;
-
-  // Whether the specific spatial layers has the bitrate set in any of its
-  // temporal layers.
-  bool IsSpatialLayerUsed(size_t spatial_index) const;
-
-  // Get the sum of all the temporal layer for a specific spatial layer.
-  uint32_t GetSpatialLayerSum(size_t spatial_index) const;
-
-  // Sum of bitrates of temporal layers, from layer 0 to |temporal_index|
-  // inclusive, of specified spatial layer |spatial_index|. Bitrates of lower
-  // spatial layers are not included.
-  uint32_t GetTemporalLayerSum(size_t spatial_index,
-                               size_t temporal_index) const;
-
-  // Returns a vector of the temporal layer bitrates for the specific spatial
-  // layer. Length of the returned vector is cropped to the highest temporal
-  // layer with a defined bitrate.
-  std::vector<uint32_t> GetTemporalLayerAllocation(size_t spatial_index) const;
-
-  uint32_t get_sum_bps() const { return sum_; }  // Sum of all bitrates.
-  uint32_t get_sum_kbps() const {
-    // Round down to not exceed the allocated bitrate.
-    return sum_ / 1000;
-  }
-
-  inline bool operator==(const BitrateAllocation& other) const {
-    return memcmp(bitrates_, other.bitrates_, sizeof(bitrates_)) == 0;
-  }
-  inline bool operator!=(const BitrateAllocation& other) const {
-    return !(*this == other);
-  }
-
-  // Expensive, please use only in tests.
-  std::string ToString() const;
-
- private:
-  uint32_t sum_;
-  uint32_t bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
-  bool has_bitrate_[kMaxSpatialLayers][kMaxTemporalStreams];
-};
+// TODO(sprang): Remove this when downstream projects have been updated.
+using BitrateAllocation = VideoBitrateAllocation;
 
 // Bandwidth over-use detector options.  These are used to drive
 // experimentation with bandwidth estimation parameters.
diff --git a/common_video/include/video_bitrate_allocator.h b/common_video/include/video_bitrate_allocator.h
index 597b625..be7cd64 100644
--- a/common_video/include/video_bitrate_allocator.h
+++ b/common_video/include/video_bitrate_allocator.h
@@ -20,8 +20,8 @@
   VideoBitrateAllocator() {}
   virtual ~VideoBitrateAllocator() {}
 
-  virtual BitrateAllocation GetAllocation(uint32_t total_bitrate,
-                                          uint32_t framerate) = 0;
+  virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate,
+                                               uint32_t framerate) = 0;
   virtual uint32_t GetPreferredBitrateBps(uint32_t framerate) = 0;
 };
 
@@ -31,7 +31,7 @@
   virtual ~VideoBitrateAllocationObserver() {}
 
   virtual void OnBitrateAllocationUpdated(
-      const BitrateAllocation& allocation) = 0;
+      const VideoBitrateAllocation& allocation) = 0;
 };
 
 }  // namespace webrtc
diff --git a/media/engine/fakewebrtcvideoengine.h b/media/engine/fakewebrtcvideoengine.h
index 2153f6b..3705a83 100644
--- a/media/engine/fakewebrtcvideoengine.h
+++ b/media/engine/fakewebrtcvideoengine.h
@@ -159,7 +159,7 @@
     return WEBRTC_VIDEO_CODEC_OK;
   }
 
-  int32_t SetRateAllocation(const webrtc::BitrateAllocation& allocation,
+  int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation,
                             uint32_t framerate) override {
     return WEBRTC_VIDEO_CODEC_OK;
   }
diff --git a/media/engine/scopedvideoencoder.cc b/media/engine/scopedvideoencoder.cc
index 41d3bb0..2a1d93d 100644
--- a/media/engine/scopedvideoencoder.cc
+++ b/media/engine/scopedvideoencoder.cc
@@ -34,7 +34,7 @@
                  const std::vector<webrtc::FrameType>* frame_types) override;
   int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
   int32_t SetRates(uint32_t bitrate, uint32_t framerate) override;
-  int32_t SetRateAllocation(const webrtc::BitrateAllocation& allocation,
+  int32_t SetRateAllocation(const webrtc::VideoBitrateAllocation& allocation,
                             uint32_t framerate) override;
   ScalingSettings GetScalingSettings() const override;
   bool SupportsNativeHandle() const override;
@@ -84,7 +84,7 @@
 }
 
 int32_t ScopedVideoEncoder::SetRateAllocation(
-    const webrtc::BitrateAllocation& allocation,
+    const webrtc::VideoBitrateAllocation& allocation,
     uint32_t framerate) {
   return encoder_->SetRateAllocation(allocation, framerate);
 }
diff --git a/media/engine/simulcast_encoder_adapter.cc b/media/engine/simulcast_encoder_adapter.cc
index e33666f..88c0a38 100644
--- a/media/engine/simulcast_encoder_adapter.cc
+++ b/media/engine/simulcast_encoder_adapter.cc
@@ -178,7 +178,7 @@
 
   codec_ = *inst;
   SimulcastRateAllocator rate_allocator(codec_);
-  BitrateAllocation allocation = rate_allocator.GetAllocation(
+  VideoBitrateAllocation allocation = rate_allocator.GetAllocation(
       codec_.startBitrate * 1000, codec_.maxFramerate);
   std::vector<uint32_t> start_bitrates;
   for (int i = 0; i < kMaxSimulcastStreams; ++i) {
@@ -367,8 +367,9 @@
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
-int SimulcastEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
-                                               uint32_t new_framerate) {
+int SimulcastEncoderAdapter::SetRateAllocation(
+    const VideoBitrateAllocation& bitrate,
+    uint32_t new_framerate) {
   RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_);
 
   if (!Initialized()) {
@@ -410,7 +411,7 @@
 
     // Slice the temporal layers out of the full allocation and pass it on to
     // the encoder handling the current simulcast stream.
-    BitrateAllocation stream_allocation;
+    VideoBitrateAllocation stream_allocation;
     for (int i = 0; i < kMaxTemporalStreams; ++i) {
       if (bitrate.HasBitrate(stream_idx, i)) {
         stream_allocation.SetBitrate(0, i, bitrate.GetBitrate(stream_idx, i));
diff --git a/media/engine/simulcast_encoder_adapter.h b/media/engine/simulcast_encoder_adapter.h
index 240a621..f336150 100644
--- a/media/engine/simulcast_encoder_adapter.h
+++ b/media/engine/simulcast_encoder_adapter.h
@@ -47,7 +47,7 @@
              const std::vector<FrameType>* frame_types) override;
   int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
-  int SetRateAllocation(const BitrateAllocation& bitrate,
+  int SetRateAllocation(const VideoBitrateAllocation& bitrate,
                         uint32_t new_framerate) override;
 
   // Eventual handler for the contained encoders' EncodedImageCallbacks, but
diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc
index b3a6bd4..2930e25 100644
--- a/media/engine/simulcast_encoder_adapter_unittest.cc
+++ b/media/engine/simulcast_encoder_adapter_unittest.cc
@@ -150,7 +150,7 @@
 
   MOCK_METHOD0(Release, int32_t());
 
-  int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
                             uint32_t framerate) {
     last_set_bitrate_ = bitrate_allocation;
     return 0;
@@ -184,7 +184,7 @@
     init_encode_return_value_ = value;
   }
 
-  BitrateAllocation last_set_bitrate() const { return last_set_bitrate_; }
+  VideoBitrateAllocation last_set_bitrate() const { return last_set_bitrate_; }
 
   MOCK_CONST_METHOD0(ImplementationName, const char*());
 
@@ -192,7 +192,7 @@
   MockVideoEncoderFactory* const factory_;
   bool supports_native_handle_ = false;
   int32_t init_encode_return_value_ = 0;
-  BitrateAllocation last_set_bitrate_;
+  VideoBitrateAllocation last_set_bitrate_;
 
   VideoCodec codec_;
   EncodedImageCallback* callback_;
@@ -679,22 +679,22 @@
   rate_allocator_.reset(new SimulcastRateAllocator(codec_));
 
   // Above min should be respected.
-  BitrateAllocation target_bitrate =
+  VideoBitrateAllocation target_bitrate =
       rate_allocator_->GetAllocation(codec_.minBitrate * 1000, 30);
   adapter_->SetRateAllocation(target_bitrate, 30);
   EXPECT_EQ(target_bitrate,
             helper_->factory()->encoders()[0]->last_set_bitrate());
 
   // Below min but non-zero should be replaced with the min bitrate.
-  BitrateAllocation too_low_bitrate =
+  VideoBitrateAllocation too_low_bitrate =
       rate_allocator_->GetAllocation((codec_.minBitrate - 1) * 1000, 30);
   adapter_->SetRateAllocation(too_low_bitrate, 30);
   EXPECT_EQ(target_bitrate,
             helper_->factory()->encoders()[0]->last_set_bitrate());
 
   // Zero should be passed on as is, since it means "pause".
-  adapter_->SetRateAllocation(BitrateAllocation(), 30);
-  EXPECT_EQ(BitrateAllocation(),
+  adapter_->SetRateAllocation(VideoBitrateAllocation(), 30);
+  EXPECT_EQ(VideoBitrateAllocation(),
             helper_->factory()->encoders()[0]->last_set_bitrate());
 }
 
diff --git a/media/engine/videoencodersoftwarefallbackwrapper.cc b/media/engine/videoencodersoftwarefallbackwrapper.cc
index 50bc3f2..bc60fde 100644
--- a/media/engine/videoencodersoftwarefallbackwrapper.cc
+++ b/media/engine/videoencodersoftwarefallbackwrapper.cc
@@ -203,7 +203,7 @@
 }
 
 int32_t VideoEncoderSoftwareFallbackWrapper::SetRateAllocation(
-    const BitrateAllocation& bitrate_allocation,
+    const VideoBitrateAllocation& bitrate_allocation,
     uint32_t framerate) {
   rates_set_ = true;
   bitrate_allocation_ = bitrate_allocation;
diff --git a/media/engine/videoencodersoftwarefallbackwrapper.h b/media/engine/videoencodersoftwarefallbackwrapper.h
index c54728e..1c472d1 100644
--- a/media/engine/videoencodersoftwarefallbackwrapper.h
+++ b/media/engine/videoencodersoftwarefallbackwrapper.h
@@ -42,7 +42,7 @@
                  const CodecSpecificInfo* codec_specific_info,
                  const std::vector<FrameType>* frame_types) override;
   int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
-  int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
                             uint32_t framerate) override;
   bool SupportsNativeHandle() const override;
   ScalingSettings GetScalingSettings() const override;
@@ -80,7 +80,7 @@
 
   // The last bitrate/framerate set, and a flag for noting they are set.
   bool rates_set_;
-  BitrateAllocation bitrate_allocation_;
+  VideoBitrateAllocation bitrate_allocation_;
   uint32_t framerate_;
 
   // The last channel parameters set, and a flag for noting they are set.
diff --git a/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc b/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc
index df04d80..07b569c 100644
--- a/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc
+++ b/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc
@@ -84,7 +84,7 @@
       return WEBRTC_VIDEO_CODEC_OK;
     }
 
-    int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
                               uint32_t framerate) override {
       ++set_rates_count_;
       return WEBRTC_VIDEO_CODEC_OK;
@@ -283,7 +283,7 @@
        SetRatesForwardedDuringFallback) {
   UtilizeFallbackEncoder();
   EXPECT_EQ(1, fake_encoder_->set_rates_count_);
-  fallback_wrapper_.SetRateAllocation(BitrateAllocation(), 1);
+  fallback_wrapper_.SetRateAllocation(VideoBitrateAllocation(), 1);
   EXPECT_EQ(2, fake_encoder_->set_rates_count_);
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release());
 }
diff --git a/media/engine/vp8_encoder_simulcast_proxy.cc b/media/engine/vp8_encoder_simulcast_proxy.cc
index 283f17b..94020c3 100644
--- a/media/engine/vp8_encoder_simulcast_proxy.cc
+++ b/media/engine/vp8_encoder_simulcast_proxy.cc
@@ -59,7 +59,7 @@
 }
 
 int VP8EncoderSimulcastProxy::SetRateAllocation(
-    const BitrateAllocation& bitrate,
+    const VideoBitrateAllocation& bitrate,
     uint32_t new_framerate) {
   return encoder_->SetRateAllocation(bitrate, new_framerate);
 }
diff --git a/media/engine/vp8_encoder_simulcast_proxy.h b/media/engine/vp8_encoder_simulcast_proxy.h
index d32f9b2..7e9fd4e 100644
--- a/media/engine/vp8_encoder_simulcast_proxy.h
+++ b/media/engine/vp8_encoder_simulcast_proxy.h
@@ -37,7 +37,7 @@
              const std::vector<FrameType>* frame_types) override;
   int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
-  int SetRateAllocation(const BitrateAllocation& bitrate,
+  int SetRateAllocation(const VideoBitrateAllocation& bitrate,
                         uint32_t new_framerate) override;
 
   VideoEncoder::ScalingSettings GetScalingSettings() const override;
diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h
index de9016a..24e658e 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp.h
@@ -399,7 +399,8 @@
   // BWE feedback packets.
   bool SendFeedbackPacket(const rtcp::TransportFeedback& packet) override = 0;
 
-  virtual void SetVideoBitrateAllocation(const BitrateAllocation& bitrate) = 0;
+  virtual void SetVideoBitrateAllocation(
+      const VideoBitrateAllocation& bitrate) = 0;
 
   // **************************************************************************
   // Audio
diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
index c556959..e535832 100644
--- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
+++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
@@ -179,7 +179,7 @@
                void(StreamDataCountersCallback*));
   MOCK_CONST_METHOD0(GetSendChannelRtpStatisticsCallback,
                      StreamDataCountersCallback*(void));
-  MOCK_METHOD1(SetVideoBitrateAllocation, void(const BitrateAllocation&));
+  MOCK_METHOD1(SetVideoBitrateAllocation, void(const VideoBitrateAllocation&));
   // Members.
   unsigned int remote_ssrc_;
 
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index abe135e..f9c542e 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -71,7 +71,7 @@
   int64_t rtt_ms = 0;
   uint32_t receiver_estimated_max_bitrate_bps = 0;
   std::unique_ptr<rtcp::TransportFeedback> transport_feedback;
-  rtc::Optional<BitrateAllocation> target_bitrate_allocation;
+  rtc::Optional<VideoBitrateAllocation> target_bitrate_allocation;
 };
 
 // Structure for handing TMMBR and TMMBN rtcp messages (RFC5104, section 3.5.4).
@@ -775,7 +775,7 @@
     return;  // Not for us.
   }
 
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   for (const auto& item : target_bitrate.GetTargetBitrates()) {
     if (item.spatial_layer >= kMaxSpatialLayers ||
         item.temporal_layer >= kMaxTemporalStreams) {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index 3c3c4b3..a7cbba1 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -93,7 +93,7 @@
     : public VideoBitrateAllocationObserver {
  public:
   MOCK_METHOD1(OnBitrateAllocationUpdated,
-               void(const BitrateAllocation& allocation));
+               void(const VideoBitrateAllocation& allocation));
 };
 
 // SSRC of remote peer, that sends rtcp packet to the rtcp receiver under test.
@@ -1318,7 +1318,7 @@
 }
 
 TEST_F(RtcpReceiverTest, ReceivesTargetBitrate) {
-  BitrateAllocation expected_allocation;
+  VideoBitrateAllocation expected_allocation;
   expected_allocation.SetBitrate(0, 0, 10000);
   expected_allocation.SetBitrate(0, 1, 20000);
   expected_allocation.SetBitrate(1, 0, 40000);
@@ -1348,7 +1348,7 @@
 }
 
 TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) {
-  BitrateAllocation expected_allocation;
+  VideoBitrateAllocation expected_allocation;
   expected_allocation.SetBitrate(0, 0, 10000);
 
   rtcp::TargetBitrate bitrate;
diff --git a/modules/rtp_rtcp/source/rtcp_sender.cc b/modules/rtp_rtcp/source/rtcp_sender.cc
index 6b266cb..5c379f7 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -947,7 +947,8 @@
   return true;
 }
 
-void RTCPSender::SetVideoBitrateAllocation(const BitrateAllocation& bitrate) {
+void RTCPSender::SetVideoBitrateAllocation(
+    const VideoBitrateAllocation& bitrate) {
   rtc::CritScope lock(&critical_section_rtcp_sender_);
   video_bitrate_allocation_.emplace(bitrate);
   SetFlag(kRtcpAnyExtendedReports, true);
diff --git a/modules/rtp_rtcp/source/rtcp_sender.h b/modules/rtp_rtcp/source/rtcp_sender.h
index f6cb55e..f77fe3c 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.h
+++ b/modules/rtp_rtcp/source/rtcp_sender.h
@@ -149,7 +149,7 @@
   void SetCsrcs(const std::vector<uint32_t>& csrcs);
 
   void SetTargetBitrate(unsigned int target_bitrate);
-  void SetVideoBitrateAllocation(const BitrateAllocation& bitrate);
+  void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate);
   bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
 
   int64_t RtcpAudioReportInverval() const;
@@ -261,7 +261,7 @@
 
   RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
 
-  rtc::Optional<BitrateAllocation> video_bitrate_allocation_
+  rtc::Optional<VideoBitrateAllocation> video_bitrate_allocation_
       RTC_GUARDED_BY(critical_section_rtcp_sender_);
 
   void SetFlag(uint32_t type, bool is_volatile)
diff --git a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
index 9851332..120a43e 100644
--- a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -823,7 +823,7 @@
   rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
   const size_t kNumSpatialLayers = 2;
   const size_t kNumTemporalLayers = 2;
-  BitrateAllocation allocation;
+  VideoBitrateAllocation allocation;
   for (size_t sl = 0; sl < kNumSpatialLayers; ++sl) {
     uint32_t start_bitrate_bps = (sl + 1) * 100000;
     for (size_t tl = 0; tl < kNumTemporalLayers; ++tl)
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_config.h b/modules/rtp_rtcp/source/rtcp_transceiver_config.h
index 75c007d..8a4a4c4 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_config.h
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_config.h
@@ -33,7 +33,7 @@
                               uint32_t rtp_time) {}
   virtual void OnBye(uint32_t sender_ssrc) {}
   virtual void OnBitrateAllocation(uint32_t sender_ssrc,
-                                   const BitrateAllocation& allocation) {}
+                                   const VideoBitrateAllocation& allocation) {}
 };
 
 struct RtcpTransceiverConfig {
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
index 925cc03..a58de8c 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
@@ -294,8 +294,8 @@
       remote_sender_it->second.observers.empty())
     return;
 
-  // Convert rtcp::TargetBitrate to BitrateAllocation from common types.
-  BitrateAllocation bitrate_allocation;
+  // Convert rtcp::TargetBitrate to VideoBitrateAllocation.
+  VideoBitrateAllocation bitrate_allocation;
   for (const rtcp::TargetBitrate::BitrateItem& item :
        target_bitrate.GetTargetBitrates()) {
     if (item.spatial_layer >= kMaxSpatialLayers ||
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
index 831e51f..8cffd28 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
@@ -35,7 +35,7 @@
 using ::testing::Return;
 using ::testing::SizeIs;
 using ::testing::StrictMock;
-using ::webrtc::BitrateAllocation;
+using ::webrtc::VideoBitrateAllocation;
 using ::webrtc::CompactNtp;
 using ::webrtc::CompactNtpRttToMs;
 using ::webrtc::MockRtcpRttStats;
@@ -60,7 +60,8 @@
  public:
   MOCK_METHOD3(OnSenderReport, void(uint32_t, NtpTime, uint32_t));
   MOCK_METHOD1(OnBye, void(uint32_t));
-  MOCK_METHOD2(OnBitrateAllocation, void(uint32_t, const BitrateAllocation&));
+  MOCK_METHOD2(OnBitrateAllocation,
+               void(uint32_t, const VideoBitrateAllocation&));
 };
 
 // Since some tests will need to wait for this period, make it small to avoid
@@ -552,7 +553,7 @@
   xr.SetTargetBitrate(target_bitrate);
   auto raw_packet = xr.Build();
 
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   bitrate_allocation.SetBitrate(0, 0, /*bitrate_bps=*/10000);
   bitrate_allocation.SetBitrate(0, 1, /*bitrate_bps=*/20000);
   bitrate_allocation.SetBitrate(1, 0, /*bitrate_bps=*/40000);
@@ -578,7 +579,7 @@
   xr.SetSenderSsrc(kRemoteSsrc);
   auto raw_packet = xr.Build();
 
-  BitrateAllocation expected_allocation;
+  VideoBitrateAllocation expected_allocation;
   expected_allocation.SetBitrate(0, 0, /*bitrate_bps=*/10000);
   EXPECT_CALL(observer, OnBitrateAllocation(kRemoteSsrc, expected_allocation));
   rtcp_transceiver.ReceivePacket(raw_packet, /*now_us=*/0);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 22e399d..07a6afb 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -927,7 +927,7 @@
 }
 
 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation(
-    const BitrateAllocation& bitrate) {
+    const VideoBitrateAllocation& bitrate) {
   rtcp_sender_.SetVideoBitrateAllocation(bitrate);
 }
 }  // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index b364a29..97afde5 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -292,7 +292,8 @@
       const ReportBlockList& report_blocks) override;
   void OnRequestSendReport() override;
 
-  void SetVideoBitrateAllocation(const BitrateAllocation& bitrate) override;
+  void SetVideoBitrateAllocation(
+      const VideoBitrateAllocation& bitrate) override;
 
  protected:
   bool UpdateRTCPReceiveInformationTimers();
diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index dffc348..02f93e1 100644
--- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -288,7 +288,7 @@
 }
 
 int32_t H264EncoderImpl::SetRateAllocation(
-    const BitrateAllocation& bitrate_allocation,
+    const VideoBitrateAllocation& bitrate_allocation,
     uint32_t framerate) {
   if (bitrate_allocation.get_sum_bps() <= 0 || framerate <= 0)
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.h b/modules/video_coding/codecs/h264/h264_encoder_impl.h
index 20d5ea6..c48439b 100644
--- a/modules/video_coding/codecs/h264/h264_encoder_impl.h
+++ b/modules/video_coding/codecs/h264/h264_encoder_impl.h
@@ -44,7 +44,7 @@
 
   int32_t RegisterEncodeCompleteCallback(
       EncodedImageCallback* callback) override;
-  int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
                             uint32_t framerate) override;
 
   // The result of encoding - an EncodedImage and RTPFragmentationHeader - are
diff --git a/modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h b/modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h
index cbdd6c3..7ce8615 100644
--- a/modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h
+++ b/modules/video_coding/codecs/multiplex/include/multiplex_encoder_adapter.h
@@ -46,7 +46,7 @@
              const std::vector<FrameType>* frame_types) override;
   int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
-  int SetRateAllocation(const BitrateAllocation& bitrate,
+  int SetRateAllocation(const VideoBitrateAllocation& bitrate,
                         uint32_t new_framerate) override;
   int Release() override;
   const char* ImplementationName() const override;
diff --git a/modules/video_coding/codecs/multiplex/multiplex_encoder_adapter.cc b/modules/video_coding/codecs/multiplex/multiplex_encoder_adapter.cc
index 7eb0d50..dcf1b56 100644
--- a/modules/video_coding/codecs/multiplex/multiplex_encoder_adapter.cc
+++ b/modules/video_coding/codecs/multiplex/multiplex_encoder_adapter.cc
@@ -174,8 +174,9 @@
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
-int MultiplexEncoderAdapter::SetRateAllocation(const BitrateAllocation& bitrate,
-                                               uint32_t framerate) {
+int MultiplexEncoderAdapter::SetRateAllocation(
+    const VideoBitrateAllocation& bitrate,
+    uint32_t framerate) {
   for (auto& encoder : encoders_) {
     // TODO(emircan): |framerate| is used to calculate duration in encoder
     // instances. We report the total frame rate to keep real time for now.
diff --git a/modules/video_coding/codecs/test/videoprocessor.h b/modules/video_coding/codecs/test/videoprocessor.h
index a56b83d..66e7525 100644
--- a/modules/video_coding/codecs/test/videoprocessor.h
+++ b/modules/video_coding/codecs/test/videoprocessor.h
@@ -188,7 +188,7 @@
   webrtc::VideoEncoder* const encoder_;
   VideoDecoderList* const decoders_;
   const std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_;
-  BitrateAllocation bitrate_allocation_ RTC_GUARDED_BY(sequence_checker_);
+  VideoBitrateAllocation bitrate_allocation_ RTC_GUARDED_BY(sequence_checker_);
   uint32_t framerate_fps_ RTC_GUARDED_BY(sequence_checker_);
 
   // Adapters for the codec callbacks.
diff --git a/modules/video_coding/codecs/test/videoprocessor_unittest.cc b/modules/video_coding/codecs/test/videoprocessor_unittest.cc
index cb01459..baf97bf 100644
--- a/modules/video_coding/codecs/test/videoprocessor_unittest.cc
+++ b/modules/video_coding/codecs/test/videoprocessor_unittest.cc
@@ -166,7 +166,7 @@
   const int kFramerateFps = 17;
   EXPECT_CALL(encoder_mock_,
               SetRateAllocation(
-                  Property(&BitrateAllocation::get_sum_kbps, kBitrateKbps),
+                  Property(&VideoBitrateAllocation::get_sum_kbps, kBitrateKbps),
                   kFramerateFps))
       .Times(1);
   DO_SYNC(q_, { video_processor_->SetRates(kBitrateKbps, kFramerateFps); });
@@ -174,9 +174,9 @@
   const int kNewBitrateKbps = 456;
   const int kNewFramerateFps = 34;
   EXPECT_CALL(encoder_mock_,
-              SetRateAllocation(
-                  Property(&BitrateAllocation::get_sum_kbps, kNewBitrateKbps),
-                  kNewFramerateFps))
+              SetRateAllocation(Property(&VideoBitrateAllocation::get_sum_kbps,
+                                         kNewBitrateKbps),
+                                kNewFramerateFps))
       .Times(1);
   DO_SYNC(q_,
           { video_processor_->SetRates(kNewBitrateKbps, kNewFramerateFps); });
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
index b1cecf0..d84d001 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
@@ -252,7 +252,7 @@
   return ret_val;
 }
 
-int LibvpxVp8Encoder::SetRateAllocation(const BitrateAllocation& bitrate,
+int LibvpxVp8Encoder::SetRateAllocation(const VideoBitrateAllocation& bitrate,
                                         uint32_t new_framerate) {
   if (!inited_)
     return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
@@ -512,7 +512,7 @@
   // at position 0 and they have highest resolution at position 0.
   int stream_idx = encoders_.size() - 1;
   SimulcastRateAllocator init_allocator(codec_);
-  BitrateAllocation allocation = init_allocator.GetAllocation(
+  VideoBitrateAllocation allocation = init_allocator.GetAllocation(
       inst->startBitrate * 1000, inst->maxFramerate);
   std::vector<uint32_t> stream_bitrates;
   for (int i = 0; i == 0 || i < inst->numberOfSimulcastStreams; ++i) {
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h
index f3e8c7a..4e9d374 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.h
@@ -46,7 +46,7 @@
 
   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
 
-  int SetRateAllocation(const BitrateAllocation& bitrate,
+  int SetRateAllocation(const VideoBitrateAllocation& bitrate,
                         uint32_t new_framerate) override;
 
   ScalingSettings GetScalingSettings() const override;
diff --git a/modules/video_coding/codecs/vp8/simulcast_rate_allocator.cc b/modules/video_coding/codecs/vp8/simulcast_rate_allocator.cc
index b819caa..5effa68 100644
--- a/modules/video_coding/codecs/vp8/simulcast_rate_allocator.cc
+++ b/modules/video_coding/codecs/vp8/simulcast_rate_allocator.cc
@@ -23,10 +23,10 @@
 SimulcastRateAllocator::SimulcastRateAllocator(const VideoCodec& codec)
     : codec_(codec) {}
 
-BitrateAllocation SimulcastRateAllocator::GetAllocation(
+VideoBitrateAllocation SimulcastRateAllocator::GetAllocation(
     uint32_t total_bitrate_bps,
     uint32_t framerate) {
-  BitrateAllocation allocated_bitrates_bps;
+  VideoBitrateAllocation allocated_bitrates_bps;
   DistributeAllocationToSimulcastLayers(total_bitrate_bps,
                                         &allocated_bitrates_bps);
   DistributeAllocationToTemporalLayers(framerate, &allocated_bitrates_bps);
@@ -35,7 +35,7 @@
 
 void SimulcastRateAllocator::DistributeAllocationToSimulcastLayers(
     uint32_t total_bitrate_bps,
-    BitrateAllocation* allocated_bitrates_bps) const {
+    VideoBitrateAllocation* allocated_bitrates_bps) const {
   uint32_t left_to_allocate = total_bitrate_bps;
   if (codec_.maxBitrate && codec_.maxBitrate * 1000 < left_to_allocate)
     left_to_allocate = codec_.maxBitrate * 1000;
@@ -111,7 +111,7 @@
 
 void SimulcastRateAllocator::DistributeAllocationToTemporalLayers(
     uint32_t framerate,
-    BitrateAllocation* allocated_bitrates_bps) const {
+    VideoBitrateAllocation* allocated_bitrates_bps) const {
   const int num_spatial_streams =
       std::max(1, static_cast<int>(codec_.numberOfSimulcastStreams));
 
diff --git a/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h b/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h
index 23d158b..7cb1a8a 100644
--- a/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h
+++ b/modules/video_coding/codecs/vp8/simulcast_rate_allocator.h
@@ -28,18 +28,18 @@
  public:
   explicit SimulcastRateAllocator(const VideoCodec& codec);
 
-  BitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
-                                  uint32_t framerate) override;
+  VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
+                                       uint32_t framerate) override;
   uint32_t GetPreferredBitrateBps(uint32_t framerate) override;
   const VideoCodec& GetCodec() const;
 
  private:
   void DistributeAllocationToSimulcastLayers(
       uint32_t total_bitrate_bps,
-      BitrateAllocation* allocated_bitrates_bps) const;
+      VideoBitrateAllocation* allocated_bitrates_bps) const;
   void DistributeAllocationToTemporalLayers(
       uint32_t framerate,
-      BitrateAllocation* allocated_bitrates_bps) const;
+      VideoBitrateAllocation* allocated_bitrates_bps) const;
   std::vector<uint32_t> DefaultTemporalLayerAllocation(int bitrate_kbps,
                                                        int max_bitrate_kbps,
                                                        int framerate,
diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
index 6db6b5b..ce4bb83 100644
--- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
@@ -85,7 +85,7 @@
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
 
   const int kBitrateBps = 300000;
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   bitrate_allocation.SetBitrate(0, 0, kBitrateBps);
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_UNINITIALIZED,
             encoder_->SetRateAllocation(bitrate_allocation,
diff --git a/modules/video_coding/codecs/vp9/svc_rate_allocator.cc b/modules/video_coding/codecs/vp9/svc_rate_allocator.cc
index e335550..46caef4 100644
--- a/modules/video_coding/codecs/vp9/svc_rate_allocator.cc
+++ b/modules/video_coding/codecs/vp9/svc_rate_allocator.cc
@@ -27,9 +27,10 @@
   RTC_DCHECK_EQ(codec.codecType, kVideoCodecVP9);
 }
 
-BitrateAllocation SvcRateAllocator::GetAllocation(uint32_t total_bitrate_bps,
-                                                  uint32_t framerate_fps) {
-  BitrateAllocation bitrate_allocation;
+VideoBitrateAllocation SvcRateAllocator::GetAllocation(
+    uint32_t total_bitrate_bps,
+    uint32_t framerate_fps) {
+  VideoBitrateAllocation bitrate_allocation;
 
   size_t num_spatial_layers = codec_.VP9().numberOfSpatialLayers;
   RTC_CHECK(num_spatial_layers > 0);
diff --git a/modules/video_coding/codecs/vp9/svc_rate_allocator.h b/modules/video_coding/codecs/vp9/svc_rate_allocator.h
index 24a3cab..cbf2096 100644
--- a/modules/video_coding/codecs/vp9/svc_rate_allocator.h
+++ b/modules/video_coding/codecs/vp9/svc_rate_allocator.h
@@ -23,8 +23,8 @@
  public:
   explicit SvcRateAllocator(const VideoCodec& codec);
 
-  BitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
-                                  uint32_t framerate_fps) override;
+  VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps,
+                                       uint32_t framerate_fps) override;
   uint32_t GetPreferredBitrateBps(uint32_t framerate_fps) override;
 
  private:
diff --git a/modules/video_coding/codecs/vp9/svc_rate_allocator_unittest.cc b/modules/video_coding/codecs/vp9/svc_rate_allocator_unittest.cc
index e894166..536950e 100644
--- a/modules/video_coding/codecs/vp9/svc_rate_allocator_unittest.cc
+++ b/modules/video_coding/codecs/vp9/svc_rate_allocator_unittest.cc
@@ -46,7 +46,7 @@
   VideoCodec codec = Configure(320, 180, 3, 3);
   SvcRateAllocator allocator = SvcRateAllocator(codec);
 
-  BitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
+  VideoBitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
   EXPECT_EQ(allocation.GetSpatialLayerSum(1), 0u);
@@ -56,7 +56,7 @@
   VideoCodec codec = Configure(640, 360, 3, 3);
   SvcRateAllocator allocator = SvcRateAllocator(codec);
 
-  BitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
+  VideoBitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
   EXPECT_GT(allocation.GetSpatialLayerSum(1), 0u);
@@ -67,7 +67,7 @@
   VideoCodec codec = Configure(1280, 720, 3, 3);
   SvcRateAllocator allocator = SvcRateAllocator(codec);
 
-  BitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
+  VideoBitrateAllocation allocation = allocator.GetAllocation(1000 * 1000, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
   EXPECT_GT(allocation.GetSpatialLayerSum(1), 0u);
@@ -81,7 +81,7 @@
 
   const SpatialLayer* layers = codec.spatialLayers;
 
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator.GetAllocation(layers[0].minBitrate * 1000 / 2, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
@@ -98,7 +98,7 @@
   size_t min_bitrate_for_640x360_layer_kbps =
       layers[0].minBitrate + layers[1].minBitrate;
 
-  BitrateAllocation allocation = allocator.GetAllocation(
+  VideoBitrateAllocation allocation = allocator.GetAllocation(
       min_bitrate_for_640x360_layer_kbps * 1000 - 1, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
@@ -114,7 +114,7 @@
   size_t min_bitrate_for_1280x720_layer_kbps =
       layers[0].minBitrate + layers[1].minBitrate + layers[2].minBitrate;
 
-  BitrateAllocation allocation = allocator.GetAllocation(
+  VideoBitrateAllocation allocation = allocator.GetAllocation(
       min_bitrate_for_1280x720_layer_kbps * 1000 - 1, 30);
 
   EXPECT_GT(allocation.GetSpatialLayerSum(0), 0u);
@@ -129,7 +129,7 @@
   const SpatialLayer* layers = codec.spatialLayers;
 
   const uint32_t link_mbps = 100;
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator.GetAllocation(link_mbps * 1000000, 30);
 
   EXPECT_EQ(allocation.get_sum_kbps(),
diff --git a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
index b16419b..d060f5f 100644
--- a/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc
@@ -224,7 +224,7 @@
             encoder_->InitEncode(&codec_settings_, 1 /* number of cores */,
                                  0 /* max payload size (unused) */));
 
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   for (size_t sl_idx = 0; sl_idx < num_spatial_layers; ++sl_idx) {
     bitrate_allocation.SetBitrate(sl_idx, 0,
                                   layers[sl_idx].targetBitrate * 1000);
@@ -283,7 +283,7 @@
 
   // Encode both base and upper layers. Check that end-of-superframe flag is
   // set on upper layer frame but not on base layer frame.
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   bitrate_allocation.SetBitrate(0, 0, layers[0].targetBitrate * 1000);
   bitrate_allocation.SetBitrate(1, 0, layers[1].targetBitrate * 1000);
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc
index 5ae44ed..5076af2 100644
--- a/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -123,7 +123,8 @@
   return num_spatial_layers_ > 1 && codec_.spatialLayers[0].targetBitrate > 0;
 }
 
-bool VP9EncoderImpl::SetSvcRates(const BitrateAllocation& bitrate_allocation) {
+bool VP9EncoderImpl::SetSvcRates(
+    const VideoBitrateAllocation& bitrate_allocation) {
   uint8_t i = 0;
 
   config_->rc_target_bitrate = bitrate_allocation.get_sum_kbps();
@@ -192,7 +193,7 @@
 }
 
 int VP9EncoderImpl::SetRateAllocation(
-    const BitrateAllocation& bitrate_allocation,
+    const VideoBitrateAllocation& bitrate_allocation,
     uint32_t frame_rate) {
   if (!inited_) {
     return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
@@ -434,7 +435,7 @@
   }
 
   SvcRateAllocator init_allocator(codec_);
-  BitrateAllocation allocation = init_allocator.GetAllocation(
+  VideoBitrateAllocation allocation = init_allocator.GetAllocation(
       inst->startBitrate * 1000, inst->maxFramerate);
   if (!SetSvcRates(allocation)) {
     return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
diff --git a/modules/video_coding/codecs/vp9/vp9_impl.h b/modules/video_coding/codecs/vp9/vp9_impl.h
index b158523..da86849 100644
--- a/modules/video_coding/codecs/vp9/vp9_impl.h
+++ b/modules/video_coding/codecs/vp9/vp9_impl.h
@@ -46,7 +46,7 @@
 
   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
 
-  int SetRateAllocation(const BitrateAllocation& bitrate_allocation,
+  int SetRateAllocation(const VideoBitrateAllocation& bitrate_allocation,
                         uint32_t frame_rate) override;
 
   const char* ImplementationName() const override;
@@ -78,7 +78,7 @@
                              bool first_frame_in_picture);
 
   bool ExplicitlyConfiguredSpatialLayers() const;
-  bool SetSvcRates(const BitrateAllocation& bitrate_allocation);
+  bool SetSvcRates(const VideoBitrateAllocation& bitrate_allocation);
 
   // Used for flexible mode to set the flags and buffer references used
   // by the encoder. Also calculates the references used by the RTP
diff --git a/modules/video_coding/generic_encoder.cc b/modules/video_coding/generic_encoder.cc
index 1490882..f9d8234 100644
--- a/modules/video_coding/generic_encoder.cc
+++ b/modules/video_coding/generic_encoder.cc
@@ -38,8 +38,9 @@
     : encoder_(encoder),
       vcm_encoded_frame_callback_(encoded_frame_callback),
       internal_source_(internal_source),
-      encoder_params_({BitrateAllocation(), 0, 0, 0}),
-      streams_or_svc_num_(0) {}
+      encoder_params_({VideoBitrateAllocation(), 0, 0, 0}),
+      streams_or_svc_num_(0),
+      codec_type_(VideoCodecType::kVideoCodecUnknown) {}
 
 VCMGenericEncoder::~VCMGenericEncoder() {}
 
diff --git a/modules/video_coding/generic_encoder.h b/modules/video_coding/generic_encoder.h
index 4efd961..03de626 100644
--- a/modules/video_coding/generic_encoder.h
+++ b/modules/video_coding/generic_encoder.h
@@ -28,7 +28,7 @@
 }  // namespace media_optimization
 
 struct EncoderParameters {
-  BitrateAllocation target_bitrate;
+  VideoBitrateAllocation target_bitrate;
   uint8_t loss_rate;
   int64_t rtt;
   uint32_t input_frame_rate;
diff --git a/modules/video_coding/include/mock/mock_video_codec_interface.h b/modules/video_coding/include/mock/mock_video_codec_interface.h
index e558b7c..82363f3 100644
--- a/modules/video_coding/include/mock/mock_video_codec_interface.h
+++ b/modules/video_coding/include/mock/mock_video_codec_interface.h
@@ -46,7 +46,7 @@
   MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
   MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
   MOCK_METHOD2(SetRateAllocation,
-               int32_t(const BitrateAllocation& newBitRate,
+               int32_t(const VideoBitrateAllocation& newBitRate,
                        uint32_t frameRate));
 };
 
diff --git a/modules/video_coding/utility/default_video_bitrate_allocator.cc b/modules/video_coding/utility/default_video_bitrate_allocator.cc
index 0c4ae9b..0124ad1 100644
--- a/modules/video_coding/utility/default_video_bitrate_allocator.cc
+++ b/modules/video_coding/utility/default_video_bitrate_allocator.cc
@@ -20,10 +20,10 @@
 
 DefaultVideoBitrateAllocator::~DefaultVideoBitrateAllocator() {}
 
-BitrateAllocation DefaultVideoBitrateAllocator::GetAllocation(
+VideoBitrateAllocation DefaultVideoBitrateAllocator::GetAllocation(
     uint32_t total_bitrate_bps,
     uint32_t framerate) {
-  BitrateAllocation allocation;
+  VideoBitrateAllocation allocation;
   if (total_bitrate_bps == 0 || !codec_.active)
     return allocation;
 
diff --git a/modules/video_coding/utility/default_video_bitrate_allocator.h b/modules/video_coding/utility/default_video_bitrate_allocator.h
index 0ef709e..6ecd878 100644
--- a/modules/video_coding/utility/default_video_bitrate_allocator.h
+++ b/modules/video_coding/utility/default_video_bitrate_allocator.h
@@ -20,8 +20,8 @@
   explicit DefaultVideoBitrateAllocator(const VideoCodec& codec);
   ~DefaultVideoBitrateAllocator() override;
 
-  BitrateAllocation GetAllocation(uint32_t total_bitrate,
-                                  uint32_t framerate) override;
+  VideoBitrateAllocation GetAllocation(uint32_t total_bitrate,
+                                       uint32_t framerate) override;
   uint32_t GetPreferredBitrateBps(uint32_t framerate) override;
 
  private:
diff --git a/modules/video_coding/utility/default_video_bitrate_allocator_unittest.cc b/modules/video_coding/utility/default_video_bitrate_allocator_unittest.cc
index e27b3d3..05b5a0a 100644
--- a/modules/video_coding/utility/default_video_bitrate_allocator_unittest.cc
+++ b/modules/video_coding/utility/default_video_bitrate_allocator_unittest.cc
@@ -41,19 +41,22 @@
 };
 
 TEST_F(DefaultVideoBitrateAllocatorTest, ZeroIsOff) {
-  BitrateAllocation allocation = allocator_->GetAllocation(0, kMaxFramerate);
+  VideoBitrateAllocation allocation =
+      allocator_->GetAllocation(0, kMaxFramerate);
   EXPECT_EQ(0u, allocation.get_sum_bps());
 }
 
 TEST_F(DefaultVideoBitrateAllocatorTest, Inactive) {
   codec_.active = false;
   allocator_.reset(new DefaultVideoBitrateAllocator(codec_));
-  BitrateAllocation allocation = allocator_->GetAllocation(1, kMaxFramerate);
+  VideoBitrateAllocation allocation =
+      allocator_->GetAllocation(1, kMaxFramerate);
   EXPECT_EQ(0u, allocation.get_sum_bps());
 }
 
 TEST_F(DefaultVideoBitrateAllocatorTest, CapsToMin) {
-  BitrateAllocation allocation = allocator_->GetAllocation(1, kMaxFramerate);
+  VideoBitrateAllocation allocation =
+      allocator_->GetAllocation(1, kMaxFramerate);
   EXPECT_EQ(kMinBitrateBps, allocation.get_sum_bps());
 
   allocation = allocator_->GetAllocation(kMinBitrateBps - 1, kMaxFramerate);
@@ -64,7 +67,7 @@
 }
 
 TEST_F(DefaultVideoBitrateAllocatorTest, CapsToMax) {
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(kMaxBitrateBps, kMaxFramerate);
   EXPECT_EQ(kMaxBitrateBps, allocation.get_sum_bps());
 
@@ -77,7 +80,7 @@
 }
 
 TEST_F(DefaultVideoBitrateAllocatorTest, GoodInBetween) {
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(kMinBitrateBps + 1, kMaxFramerate);
   EXPECT_EQ(kMinBitrateBps + 1, allocation.get_sum_bps());
 
diff --git a/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc b/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
index f986d3b..aa9b320 100644
--- a/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
+++ b/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
@@ -65,7 +65,8 @@
   }
 
   template <size_t S>
-  void ExpectEqual(uint32_t (&expected)[S], const BitrateAllocation& actual) {
+  void ExpectEqual(uint32_t (&expected)[S],
+                   const VideoBitrateAllocation& actual) {
     // EXPECT_EQ(S, actual.size());
     uint32_t sum = 0;
     for (size_t i = 0; i < S; ++i) {
@@ -112,7 +113,7 @@
     }
   }
 
-  BitrateAllocation GetAllocation(uint32_t target_bitrate) {
+  VideoBitrateAllocation GetAllocation(uint32_t target_bitrate) {
     return allocator_->GetAllocation(target_bitrate * 1000U, kDefaultFrameRate);
   }
 
@@ -138,7 +139,7 @@
 }
 
 TEST_F(SimulcastRateAllocatorTest, NoSimulcastNoMax) {
-  const uint32_t kMax = BitrateAllocation::kMaxBitrateBps / 1000;
+  const uint32_t kMax = VideoBitrateAllocation::kMaxBitrateBps / 1000;
   codec_.active = true;
   codec_.maxBitrate = 0;
   CreateAllocator();
@@ -528,7 +529,7 @@
   SetupConferenceScreenshare(GetParam());
   CreateAllocator();
 
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(kTargetBitrateKbps * 1000, kFramerateFps);
 
   // All allocation should go in TL0.
@@ -541,7 +542,7 @@
   CreateAllocator();
 
   uint32_t target_bitrate_kbps = (kTargetBitrateKbps + kMaxBitrateKbps) / 2;
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(target_bitrate_kbps * 1000, kFramerateFps);
 
   // Fill TL0, then put the rest in TL1.
@@ -555,7 +556,7 @@
   SetupConferenceScreenshare(GetParam());
   CreateAllocator();
 
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(kMaxBitrateKbps * 2000, kFramerateFps);
 
   // Fill both TL0 and TL1, but no more.
@@ -573,7 +574,7 @@
 
   // Enough bitrate for TL0 and TL1.
   uint32_t target_bitrate_kbps = (kTargetBitrateKbps + kMaxBitrateKbps) / 2;
-  BitrateAllocation allocation =
+  VideoBitrateAllocation allocation =
       allocator_->GetAllocation(target_bitrate_kbps * 1000, kFramerateFps);
 
   EXPECT_EQ(0U, allocation.get_sum_kbps());
diff --git a/modules/video_coding/video_codec_initializer_unittest.cc b/modules/video_coding/video_codec_initializer_unittest.cc
index 2bb67cb..2ef1159 100644
--- a/modules/video_coding/video_codec_initializer_unittest.cc
+++ b/modules/video_coding/video_codec_initializer_unittest.cc
@@ -135,8 +135,9 @@
   streams_.push_back(DefaultStream());
   EXPECT_TRUE(InitializeCodec());
 
-  BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
-      kDefaultTargetBitrateBps, kDefaultFrameRate);
+  VideoBitrateAllocation bitrate_allocation =
+      bitrate_allocator_out_->GetAllocation(kDefaultTargetBitrateBps,
+                                            kDefaultFrameRate);
   EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams);
   EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
   EXPECT_EQ(kDefaultTargetBitrateBps, bitrate_allocation.get_sum_bps());
@@ -149,8 +150,9 @@
   streams_.push_back(inactive_stream);
   EXPECT_TRUE(InitializeCodec());
 
-  BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
-      kDefaultTargetBitrateBps, kDefaultFrameRate);
+  VideoBitrateAllocation bitrate_allocation =
+      bitrate_allocator_out_->GetAllocation(kDefaultTargetBitrateBps,
+                                            kDefaultFrameRate);
   EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams);
   EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
   EXPECT_EQ(0U, bitrate_allocation.get_sum_bps());
@@ -163,8 +165,9 @@
 
   EXPECT_EQ(1u, codec_out_.numberOfSimulcastStreams);
   EXPECT_EQ(2u, codec_out_.VP8()->numberOfTemporalLayers);
-  BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
-      kScreenshareCodecTargetBitrateBps, kScreenshareDefaultFramerate);
+  VideoBitrateAllocation bitrate_allocation =
+      bitrate_allocator_out_->GetAllocation(kScreenshareCodecTargetBitrateBps,
+                                            kScreenshareDefaultFramerate);
   EXPECT_EQ(kScreenshareCodecTargetBitrateBps,
             bitrate_allocation.get_sum_bps());
   EXPECT_EQ(kScreenshareTl0BitrateBps, bitrate_allocation.GetBitrate(0, 0));
@@ -182,8 +185,9 @@
   EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
   const uint32_t max_bitrate_bps =
       streams_[0].target_bitrate_bps + streams_[1].max_bitrate_bps;
-  BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
-      max_bitrate_bps, kScreenshareDefaultFramerate);
+  VideoBitrateAllocation bitrate_allocation =
+      bitrate_allocator_out_->GetAllocation(max_bitrate_bps,
+                                            kScreenshareDefaultFramerate);
   EXPECT_EQ(max_bitrate_bps, bitrate_allocation.get_sum_bps());
   EXPECT_EQ(static_cast<uint32_t>(streams_[0].target_bitrate_bps),
             bitrate_allocation.GetSpatialLayerSum(0));
@@ -206,8 +210,9 @@
   EXPECT_EQ(1u, codec_out_.VP8()->numberOfTemporalLayers);
   const uint32_t target_bitrate =
       streams_[0].target_bitrate_bps + streams_[1].target_bitrate_bps;
-  BitrateAllocation bitrate_allocation = bitrate_allocator_out_->GetAllocation(
-      target_bitrate, kScreenshareDefaultFramerate);
+  VideoBitrateAllocation bitrate_allocation =
+      bitrate_allocator_out_->GetAllocation(target_bitrate,
+                                            kScreenshareDefaultFramerate);
   EXPECT_EQ(static_cast<uint32_t>(streams_[0].max_bitrate_bps),
             bitrate_allocation.get_sum_bps());
   EXPECT_EQ(static_cast<uint32_t>(streams_[0].max_bitrate_bps),
@@ -229,7 +234,7 @@
   EXPECT_EQ(3u, codec_out_.VP8()->numberOfTemporalLayers);
   const uint32_t max_bitrate_bps =
       streams_[0].target_bitrate_bps + streams_[1].max_bitrate_bps;
-  BitrateAllocation bitrate_allocation =
+  VideoBitrateAllocation bitrate_allocation =
       bitrate_allocator_out_->GetAllocation(max_bitrate_bps, kDefaultFrameRate);
   EXPECT_EQ(max_bitrate_bps, bitrate_allocation.get_sum_bps());
   EXPECT_EQ(static_cast<uint32_t>(streams_[0].target_bitrate_bps),
diff --git a/modules/video_coding/video_sender.cc b/modules/video_coding/video_sender.cc
index 680b76f..c8150a8 100644
--- a/modules/video_coding/video_sender.cc
+++ b/modules/video_coding/video_sender.cc
@@ -35,7 +35,7 @@
       _codecDataBase(&_encodedFrameCallback),
       frame_dropper_enabled_(true),
       current_codec_(),
-      encoder_params_({BitrateAllocation(), 0, 0, 0}),
+      encoder_params_({VideoBitrateAllocation(), 0, 0, 0}),
       encoder_has_internal_source_(false),
       next_frame_types_(1, kVideoFrameDelta) {
   _mediaOpt.Reset();
@@ -150,7 +150,7 @@
   if (input_frame_rate == 0)
     input_frame_rate = current_codec_.maxFramerate;
 
-  BitrateAllocation bitrate_allocation;
+  VideoBitrateAllocation bitrate_allocation;
   // Only call allocators if bitrate > 0 (ie, not suspended), otherwise they
   // might cap the bitrate to the min bitrate configured.
   if (target_bitrate_bps > 0) {
@@ -171,7 +171,7 @@
 void VideoSender::UpdateChannelParameters(
     VideoBitrateAllocator* bitrate_allocator,
     VideoBitrateAllocationObserver* bitrate_updated_callback) {
-  BitrateAllocation target_rate;
+  VideoBitrateAllocation target_rate;
   {
     rtc::CritScope cs(&params_crit_);
     encoder_params_ =
diff --git a/modules/video_coding/video_sender_unittest.cc b/modules/video_coding/video_sender_unittest.cc
index 8e1330a..877eb99 100644
--- a/modules/video_coding/video_sender_unittest.cc
+++ b/modules/video_coding/video_sender_unittest.cc
@@ -306,7 +306,7 @@
   const uint32_t new_bitrate_kbps = settings_.startBitrate + 300;
 
   // Initial frame rate is taken from config, as we have no data yet.
-  BitrateAllocation new_rate_allocation = rate_allocator_->GetAllocation(
+  VideoBitrateAllocation new_rate_allocation = rate_allocator_->GetAllocation(
       new_bitrate_kbps * 1000, settings_.maxFramerate);
   EXPECT_CALL(encoder_,
               SetRateAllocation(new_rate_allocation, settings_.maxFramerate))
@@ -351,7 +351,7 @@
   // Update encoder bitrate parameters. We expect that to immediately call
   // SetRates on the encoder without waiting for AddFrame processing.
   const uint32_t new_bitrate_kbps = settings_.startBitrate + 300;
-  BitrateAllocation new_rate_allocation = rate_allocator_->GetAllocation(
+  VideoBitrateAllocation new_rate_allocation = rate_allocator_->GetAllocation(
       new_bitrate_kbps * 1000, settings_.maxFramerate);
   EXPECT_CALL(encoder_, SetRateAllocation(new_rate_allocation, _))
       .Times(1)
@@ -383,7 +383,7 @@
   // Call to SetChannelParameters with changed bitrate should call encoder
   // SetRates but not encoder SetChannelParameters (that are unchanged).
   uint32_t new_bitrate_bps = 2 * settings_.startBitrate * 1000;
-  BitrateAllocation new_rate_allocation =
+  VideoBitrateAllocation new_rate_allocation =
       rate_allocator_->GetAllocation(new_bitrate_bps, kInputFps);
   EXPECT_CALL(encoder_, SetRateAllocation(new_rate_allocation, kInputFps))
       .Times(1)
diff --git a/sdk/android/src/jni/androidmediaencoder.cc b/sdk/android/src/jni/androidmediaencoder.cc
index a75d037..5e59f06 100644
--- a/sdk/android/src/jni/androidmediaencoder.cc
+++ b/sdk/android/src/jni/androidmediaencoder.cc
@@ -110,7 +110,7 @@
   int32_t Release() override;
   int32_t SetChannelParameters(uint32_t /* packet_loss */,
                                int64_t /* rtt */) override;
-  int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
                             uint32_t frame_rate) override;
 
   bool SupportsNativeHandle() const override { return egl_context_ != nullptr; }
@@ -951,7 +951,7 @@
 }
 
 int32_t MediaCodecVideoEncoder::SetRateAllocation(
-    const BitrateAllocation& rate_allocation,
+    const VideoBitrateAllocation& rate_allocation,
     uint32_t frame_rate) {
   RTC_DCHECK_CALLED_SEQUENTIALLY(&encoder_queue_checker_);
   const uint32_t new_bit_rate = rate_allocation.get_sum_kbps();
diff --git a/sdk/android/src/jni/videoencoderwrapper.cc b/sdk/android/src/jni/videoencoderwrapper.cc
index 4f4086b..621f824 100644
--- a/sdk/android/src/jni/videoencoderwrapper.cc
+++ b/sdk/android/src/jni/videoencoderwrapper.cc
@@ -149,7 +149,7 @@
 }
 
 int32_t VideoEncoderWrapper::SetRateAllocation(
-    const BitrateAllocation& allocation,
+    const VideoBitrateAllocation& allocation,
     uint32_t framerate) {
   JNIEnv* jni = AttachCurrentThreadIfNeeded();
 
@@ -437,7 +437,7 @@
 
 ScopedJavaLocalRef<jobject> VideoEncoderWrapper::ToJavaBitrateAllocation(
     JNIEnv* jni,
-    const BitrateAllocation& allocation) {
+    const VideoBitrateAllocation& allocation) {
   ScopedJavaLocalRef<jobjectArray> j_allocation_array(
       jni, jni->NewObjectArray(kMaxSpatialLayers, int_array_class_.obj(),
                                nullptr /* initial */));
diff --git a/sdk/android/src/jni/videoencoderwrapper.h b/sdk/android/src/jni/videoencoderwrapper.h
index f25e83d..c58a0af 100644
--- a/sdk/android/src/jni/videoencoderwrapper.h
+++ b/sdk/android/src/jni/videoencoderwrapper.h
@@ -47,7 +47,7 @@
 
   int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
 
-  int32_t SetRateAllocation(const BitrateAllocation& allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
                             uint32_t framerate) override;
 
   ScalingSettings GetScalingSettings() const override;
@@ -89,7 +89,7 @@
   CodecSpecificInfo ParseCodecSpecificInfo(const EncodedImage& frame);
   ScopedJavaLocalRef<jobject> ToJavaBitrateAllocation(
       JNIEnv* jni,
-      const BitrateAllocation& allocation);
+      const VideoBitrateAllocation& allocation);
   std::string GetImplementationName(JNIEnv* jni) const;
 
   const ScopedJavaGlobalRef<jobject> encoder_;
diff --git a/test/configurable_frame_size_encoder.cc b/test/configurable_frame_size_encoder.cc
index f09be53..107c4cb 100644
--- a/test/configurable_frame_size_encoder.cc
+++ b/test/configurable_frame_size_encoder.cc
@@ -74,7 +74,7 @@
 }
 
 int32_t ConfigurableFrameSizeEncoder::SetRateAllocation(
-    const BitrateAllocation& allocation,
+    const VideoBitrateAllocation& allocation,
     uint32_t framerate) {
   return WEBRTC_VIDEO_CODEC_OK;
 }
diff --git a/test/configurable_frame_size_encoder.h b/test/configurable_frame_size_encoder.h
index f3733c8..b8c3b83 100644
--- a/test/configurable_frame_size_encoder.h
+++ b/test/configurable_frame_size_encoder.h
@@ -39,7 +39,7 @@
 
   int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
 
-  int32_t SetRateAllocation(const BitrateAllocation& allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& allocation,
                             uint32_t framerate) override;
 
   int32_t SetFrameSize(size_t size);
diff --git a/test/encoder_proxy_factory.h b/test/encoder_proxy_factory.h
index 9c7ff0c..2982010 100644
--- a/test/encoder_proxy_factory.h
+++ b/test/encoder_proxy_factory.h
@@ -82,7 +82,7 @@
     int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override {
       return encoder_->SetChannelParameters(packet_loss, rtt);
     }
-    int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
                               uint32_t framerate) override {
       return encoder_->SetRateAllocation(rate_allocation, framerate);
     }
diff --git a/test/fake_encoder.cc b/test/fake_encoder.cc
index a7dbbd9..c8d13cb 100644
--- a/test/fake_encoder.cc
+++ b/test/fake_encoder.cc
@@ -178,8 +178,9 @@
   return 0;
 }
 
-int32_t FakeEncoder::SetRateAllocation(const BitrateAllocation& rate_allocation,
-                                       uint32_t framerate) {
+int32_t FakeEncoder::SetRateAllocation(
+    const VideoBitrateAllocation& rate_allocation,
+    uint32_t framerate) {
   rtc::CritScope cs(&crit_sect_);
   target_bitrate_ = rate_allocation;
   configured_input_framerate_ = framerate;
diff --git a/test/fake_encoder.h b/test/fake_encoder.h
index f6ed289..2700f3d 100644
--- a/test/fake_encoder.h
+++ b/test/fake_encoder.h
@@ -42,7 +42,7 @@
       EncodedImageCallback* callback) override;
   int32_t Release() override;
   int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
-  int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
                             uint32_t framerate) override;
   const char* ImplementationName() const override;
   int GetConfiguredInputFramerate() const;
@@ -53,7 +53,7 @@
   Clock* const clock_;
   VideoCodec config_ RTC_GUARDED_BY(crit_sect_);
   EncodedImageCallback* callback_ RTC_GUARDED_BY(crit_sect_);
-  BitrateAllocation target_bitrate_ RTC_GUARDED_BY(crit_sect_);
+  VideoBitrateAllocation target_bitrate_ RTC_GUARDED_BY(crit_sect_);
   int configured_input_framerate_ RTC_GUARDED_BY(crit_sect_);
   int max_target_bitrate_kbps_ RTC_GUARDED_BY(crit_sect_);
   bool pending_keyframe_ RTC_GUARDED_BY(crit_sect_);
diff --git a/video/end_to_end_tests/bandwidth_tests.cc b/video/end_to_end_tests/bandwidth_tests.cc
index 50e874b..dc4e1c9 100644
--- a/video/end_to_end_tests/bandwidth_tests.cc
+++ b/video/end_to_end_tests/bandwidth_tests.cc
@@ -299,7 +299,7 @@
       RTC_DCHECK_EQ(1, encoder_config->number_of_streams);
     }
 
-    int32_t SetRateAllocation(const BitrateAllocation& rate_allocation,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation,
                               uint32_t framerate) override {
       // Make sure not to trigger on any default zero bitrates.
       if (rate_allocation.get_sum_bps() == 0)
diff --git a/video/payload_router.cc b/video/payload_router.cc
index b06908f..b762577 100644
--- a/video/payload_router.cc
+++ b/video/payload_router.cc
@@ -266,15 +266,15 @@
 }
 
 void PayloadRouter::OnBitrateAllocationUpdated(
-    const BitrateAllocation& bitrate) {
+    const VideoBitrateAllocation& bitrate) {
   rtc::CritScope lock(&crit_);
   if (IsActive()) {
     if (rtp_modules_.size() == 1) {
       // If spatial scalability is enabled, it is covered by a single stream.
       rtp_modules_[0]->SetVideoBitrateAllocation(bitrate);
     } else {
-      // Simulcast is in use, split the BitrateAllocation into one struct per
-      // rtp stream, moving over the temporal layer allocation.
+      // Simulcast is in use, split the VideoBitrateAllocation into one struct
+      // per rtp stream, moving over the temporal layer allocation.
       for (size_t si = 0; si < rtp_modules_.size(); ++si) {
         // Don't send empty TargetBitrate messages on streams not being relayed.
         if (!bitrate.IsSpatialLayerUsed(si)) {
@@ -283,7 +283,7 @@
           continue;
         }
 
-        BitrateAllocation layer_bitrate;
+        VideoBitrateAllocation layer_bitrate;
         for (int tl = 0; tl < kMaxTemporalStreams; ++tl) {
           if (bitrate.HasBitrate(si, tl))
             layer_bitrate.SetBitrate(0, tl, bitrate.GetBitrate(si, tl));
diff --git a/video/payload_router.h b/video/payload_router.h
index e32d607..dc6284d 100644
--- a/video/payload_router.h
+++ b/video/payload_router.h
@@ -60,7 +60,7 @@
       const CodecSpecificInfo* codec_specific_info,
       const RTPFragmentationHeader* fragmentation) override;
 
-  void OnBitrateAllocationUpdated(const BitrateAllocation& bitrate);
+  void OnBitrateAllocationUpdated(const VideoBitrateAllocation& bitrate);
 
  private:
   class RtpPayloadParams;
diff --git a/video/payload_router_unittest.cc b/video/payload_router_unittest.cc
index af57442..a559be0 100644
--- a/video/payload_router_unittest.cc
+++ b/video/payload_router_unittest.cc
@@ -232,17 +232,17 @@
   PayloadRouter payload_router(modules, {kSsrc1, kSsrc2}, kPayloadType, {});
   payload_router.SetActive(true);
 
-  BitrateAllocation bitrate;
+  VideoBitrateAllocation bitrate;
   bitrate.SetBitrate(0, 0, 10000);
   bitrate.SetBitrate(0, 1, 20000);
   bitrate.SetBitrate(1, 0, 40000);
   bitrate.SetBitrate(1, 1, 80000);
 
-  BitrateAllocation layer0_bitrate;
+  VideoBitrateAllocation layer0_bitrate;
   layer0_bitrate.SetBitrate(0, 0, 10000);
   layer0_bitrate.SetBitrate(0, 1, 20000);
 
-  BitrateAllocation layer1_bitrate;
+  VideoBitrateAllocation layer1_bitrate;
   layer1_bitrate.SetBitrate(0, 0, 40000);
   layer1_bitrate.SetBitrate(0, 1, 80000);
 
@@ -265,17 +265,17 @@
   payload_router.SetActive(true);
 
   // Create bitrate allocation with bitrate only for the first and third stream.
-  BitrateAllocation bitrate;
+  VideoBitrateAllocation bitrate;
   bitrate.SetBitrate(0, 0, 10000);
   bitrate.SetBitrate(0, 1, 20000);
   bitrate.SetBitrate(2, 0, 40000);
   bitrate.SetBitrate(2, 1, 80000);
 
-  BitrateAllocation layer0_bitrate;
+  VideoBitrateAllocation layer0_bitrate;
   layer0_bitrate.SetBitrate(0, 0, 10000);
   layer0_bitrate.SetBitrate(0, 1, 20000);
 
-  BitrateAllocation layer2_bitrate;
+  VideoBitrateAllocation layer2_bitrate;
   layer2_bitrate.SetBitrate(0, 0, 40000);
   layer2_bitrate.SetBitrate(0, 1, 80000);
 
@@ -294,7 +294,7 @@
   PayloadRouter payload_router(modules, {kSsrc1}, kPayloadType, {});
   payload_router.SetActive(true);
 
-  BitrateAllocation bitrate;
+  VideoBitrateAllocation bitrate;
   bitrate.SetBitrate(0, 0, 10000);
   bitrate.SetBitrate(0, 1, 20000);
   bitrate.SetBitrate(1, 0, 40000);
diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc
index 5e032fc..f2bb8d3 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -583,7 +583,7 @@
 }
 
 void VideoSendStreamImpl::OnBitrateAllocationUpdated(
-    const BitrateAllocation& allocation) {
+    const VideoBitrateAllocation& allocation) {
   payload_router_.OnBitrateAllocationUpdated(allocation);
 }
 
diff --git a/video/video_send_stream_impl.h b/video/video_send_stream_impl.h
index d237dfd..84fca8f 100644
--- a/video/video_send_stream_impl.h
+++ b/video/video_send_stream_impl.h
@@ -126,7 +126,8 @@
       const RTPFragmentationHeader* fragmentation) override;
 
   // Implements VideoBitrateAllocationObserver.
-  void OnBitrateAllocationUpdated(const BitrateAllocation& allocation) override;
+  void OnBitrateAllocationUpdated(
+      const VideoBitrateAllocation& allocation) override;
 
   // Starts monitoring and sends a keyframe.
   void StartupVideoSendStream();
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index 1073a0c..1b25108 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -2052,7 +2052,7 @@
     return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size);
   }
 
-  int32_t SetRateAllocation(const BitrateAllocation& bitrate,
+  int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate,
                             uint32_t framerate) override {
     rtc::CritScope lock(&crit_);
     bitrate_kbps_ = bitrate.get_sum_kbps();
@@ -2884,7 +2884,7 @@
                                      maxPayloadSize);
     }
 
-    int32_t SetRateAllocation(const BitrateAllocation& bitrate,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate,
                               uint32_t frameRate) override {
       {
         rtc::CritScope lock(&crit_);
@@ -3657,7 +3657,7 @@
           first_packet_sent_(false),
           bitrate_changed_event_(false, false) {}
 
-    int32_t SetRateAllocation(const BitrateAllocation& bitrate,
+    int32_t SetRateAllocation(const VideoBitrateAllocation& bitrate,
                               uint32_t frameRate) override {
       rtc::CritScope lock(&crit_);
       // Wait for the first sent packet so that videosendstream knows
diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc
index 85d4118..5289f9a 100644
--- a/video/video_stream_encoder_unittest.cc
+++ b/video/video_stream_encoder_unittest.cc
@@ -260,7 +260,7 @@
 
 class MockBitrateObserver : public VideoBitrateAllocationObserver {
  public:
-  MOCK_METHOD1(OnBitrateAllocationUpdated, void(const BitrateAllocation&));
+  MOCK_METHOD1(OnBitrateAllocationUpdated, void(const VideoBitrateAllocation&));
 };
 
 }  // namespace
@@ -2247,7 +2247,7 @@
   video_stream_encoder_->SetBitrateObserver(&bitrate_observer);
 
   const int kDefaultFps = 30;
-  const BitrateAllocation expected_bitrate =
+  const VideoBitrateAllocation expected_bitrate =
       DefaultVideoBitrateAllocator(fake_encoder_.codec_config())
           .GetAllocation(kLowTargetBitrateBps, kDefaultFps);