Make SpatialLayer to be an alias of SimulcastStream

Bug: b/337757868, b/42234533
Change-Id: I3a5088c2ef64ebc48b37aa51b3ebb7cd395e537b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349960
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42280}
diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn
index e5b34f8..6167c1f 100644
--- a/api/video_codecs/BUILD.gn
+++ b/api/video_codecs/BUILD.gn
@@ -52,7 +52,6 @@
     "sdp_video_format.h",
     "simulcast_stream.cc",
     "simulcast_stream.h",
-    "spatial_layer.cc",
     "spatial_layer.h",
     "video_codec.cc",
     "video_codec.h",
diff --git a/api/video_codecs/simulcast_stream.cc b/api/video_codecs/simulcast_stream.cc
index a867597..4139a38 100644
--- a/api/video_codecs/simulcast_stream.cc
+++ b/api/video_codecs/simulcast_stream.cc
@@ -36,4 +36,14 @@
   return scalability_modes[numberOfTemporalLayers - 1];
 }
 
+bool SimulcastStream::operator==(const SimulcastStream& other) const {
+  return (width == other.width && height == other.height &&
+          maxFramerate == other.maxFramerate &&
+          numberOfTemporalLayers == other.numberOfTemporalLayers &&
+          maxBitrate == other.maxBitrate &&
+          targetBitrate == other.targetBitrate &&
+          minBitrate == other.minBitrate && qpMax == other.qpMax &&
+          active == other.active);
+}
+
 }  // namespace webrtc
diff --git a/api/video_codecs/simulcast_stream.h b/api/video_codecs/simulcast_stream.h
index 6521536..78976b3 100644
--- a/api/video_codecs/simulcast_stream.h
+++ b/api/video_codecs/simulcast_stream.h
@@ -25,6 +25,11 @@
   absl::optional<ScalabilityMode> GetScalabilityMode() const;
   void SetNumberOfTemporalLayers(unsigned char n);
 
+  bool operator==(const SimulcastStream& other) const;
+  bool operator!=(const SimulcastStream& other) const {
+    return !(*this == other);
+  }
+
   int width = 0;
   int height = 0;
   float maxFramerate = 0;  // fps.
diff --git a/api/video_codecs/spatial_layer.cc b/api/video_codecs/spatial_layer.cc
deleted file mode 100644
index 25ccdfe..0000000
--- a/api/video_codecs/spatial_layer.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  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/video_codecs/spatial_layer.h"
-
-namespace webrtc {
-
-bool SpatialLayer::operator==(const SpatialLayer& other) const {
-  return (width == other.width && height == other.height &&
-          maxFramerate == other.maxFramerate &&
-          numberOfTemporalLayers == other.numberOfTemporalLayers &&
-          maxBitrate == other.maxBitrate &&
-          targetBitrate == other.targetBitrate &&
-          minBitrate == other.minBitrate && qpMax == other.qpMax &&
-          active == other.active);
-}
-
-}  // namespace webrtc
diff --git a/api/video_codecs/spatial_layer.h b/api/video_codecs/spatial_layer.h
index 5a1b425..4003f0b 100644
--- a/api/video_codecs/spatial_layer.h
+++ b/api/video_codecs/spatial_layer.h
@@ -11,22 +11,11 @@
 #ifndef API_VIDEO_CODECS_SPATIAL_LAYER_H_
 #define API_VIDEO_CODECS_SPATIAL_LAYER_H_
 
+#include "api/video_codecs/simulcast_stream.h"
+
 namespace webrtc {
 
-struct SpatialLayer {
-  bool operator==(const SpatialLayer& other) const;
-  bool operator!=(const SpatialLayer& other) const { return !(*this == other); }
-
-  unsigned short width;   // NOLINT(runtime/int)
-  unsigned short height;  // NOLINT(runtime/int)
-  float maxFramerate;     // fps.
-  unsigned char numberOfTemporalLayers;
-  unsigned int maxBitrate;     // kilobits/sec.
-  unsigned int targetBitrate;  // kilobits/sec.
-  unsigned int minBitrate;     // kilobits/sec.
-  unsigned int qpMax;          // minimum quality
-  bool active;                 // encoded and sent.
-};
+typedef SimulcastStream SpatialLayer;
 
 }  // namespace webrtc
 #endif  // API_VIDEO_CODECS_SPATIAL_LAYER_H_
diff --git a/modules/video_coding/codecs/vp9/include/vp9_globals.h b/modules/video_coding/codecs/vp9/include/vp9_globals.h
index 0614a3c..204cc60 100644
--- a/modules/video_coding/codecs/vp9/include/vp9_globals.h
+++ b/modules/video_coding/codecs/vp9/include/vp9_globals.h
@@ -30,8 +30,8 @@
 const size_t kMaxVp9FramesInGof = 0xFF;  // 8 bits
 const size_t kMaxVp9NumberOfSpatialLayers = 8;
 
-const size_t kMinVp9SpatialLayerLongSideLength = 240;
-const size_t kMinVp9SpatialLayerShortSideLength = 135;
+const int kMinVp9SpatialLayerLongSideLength = 240;
+const int kMinVp9SpatialLayerShortSideLength = 135;
 
 enum TemporalStructureMode {
   kTemporalStructureMode1,  // 1 temporal layer structure - i.e., IPPP...
diff --git a/modules/video_coding/codecs/vp9/svc_config_unittest.cc b/modules/video_coding/codecs/vp9/svc_config_unittest.cc
index 2515b1c..ba3b22f 100644
--- a/modules/video_coding/codecs/vp9/svc_config_unittest.cc
+++ b/modules/video_coding/codecs/vp9/svc_config_unittest.cc
@@ -174,7 +174,7 @@
 
 TEST(SvcConfig, EnforcesMinimalRequiredParity) {
   const size_t max_num_spatial_layers = 3;
-  const size_t kOddSize = 1023;
+  const int kOddSize = 1023;
 
   std::vector<SpatialLayer> spatial_layers =
       GetSvcConfig(kOddSize, kOddSize, 30,