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}
This commit is contained in:
Sergey Silkin 2024-05-08 06:51:44 +00:00 committed by WebRTC LUCI CQ
parent 042973f624
commit 29d4062ff6
7 changed files with 21 additions and 43 deletions

View file

@ -52,7 +52,6 @@ rtc_library("video_codecs_api") {
"sdp_video_format.h",
"simulcast_stream.cc",
"simulcast_stream.h",
"spatial_layer.cc",
"spatial_layer.h",
"video_codec.cc",
"video_codec.h",

View file

@ -36,4 +36,14 @@ absl::optional<ScalabilityMode> SimulcastStream::GetScalabilityMode() const {
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

View file

@ -25,6 +25,11 @@ struct SimulcastStream {
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.

View file

@ -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

View file

@ -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_

View file

@ -30,8 +30,8 @@ const size_t kMaxVp9RefPics = 3;
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...

View file

@ -174,7 +174,7 @@ TEST(SvcConfig, AlwaysSendsAtLeastOneLayerPortrait) {
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,