Add temporary accessors for numberOfTemporalLayers

Intended to be used in downstream code when deleting deleting this
attribute.

Bug: webrtc:11607
Change-Id: I39417997a2ec2e72d726da476b5bce88abe267b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267843
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37445}
This commit is contained in:
Niels Möller 2022-07-05 14:22:27 +02:00 committed by WebRTC LUCI CQ
parent a1a7c638ec
commit 79924579f3
4 changed files with 55 additions and 0 deletions

View File

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

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 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/simulcast_stream.h"
#include "rtc_base/checks.h"
namespace webrtc {
unsigned char SimulcastStream::GetNumberOfTemporalLayers() const {
return numberOfTemporalLayers;
}
ScalabilityMode SimulcastStream::GetScalabilityMode() const {
RTC_CHECK_GE(numberOfTemporalLayers, 1);
RTC_CHECK_LE(numberOfTemporalLayers, 3);
static const ScalabilityMode scalability_modes[3] = {
ScalabilityMode::kL1T1,
ScalabilityMode::kL1T2,
ScalabilityMode::kL1T3,
};
return scalability_modes[numberOfTemporalLayers - 1];
}
} // namespace webrtc

View File

@ -11,11 +11,18 @@
#ifndef API_VIDEO_CODECS_SIMULCAST_STREAM_H_
#define API_VIDEO_CODECS_SIMULCAST_STREAM_H_
#include "api/video_codecs/scalability_mode.h"
namespace webrtc {
// TODO(bugs.webrtc.org/6883): Unify with struct VideoStream, part of
// VideoEncoderConfig.
struct SimulcastStream {
// Temporary utility methods for transition from numberOfTemporalLayers
// setting to ScalabilityMode.
unsigned char GetNumberOfTemporalLayers() const;
ScalabilityMode GetScalabilityMode() const;
int width = 0;
int height = 0;
float maxFramerate = 0; // fps.

View File

@ -44,6 +44,11 @@ struct VideoCodecVP8 {
bool operator!=(const VideoCodecVP8& other) const {
return !(*this == other);
}
// Temporary utility method for transition deleting numberOfTemporalLayers
// setting (replaced by ScalabilityMode).
void SetNumberOfTemporalLayers(unsigned char n) {
numberOfTemporalLayers = n;
}
unsigned char numberOfTemporalLayers;
bool denoisingOn;
bool automaticResizeOn;
@ -62,6 +67,11 @@ struct VideoCodecVP9 {
bool operator!=(const VideoCodecVP9& other) const {
return !(*this == other);
}
// Temporary utility method for transition deleting numberOfTemporalLayers
// setting (replaced by ScalabilityMode).
void SetNumberOfTemporalLayers(unsigned char n) {
numberOfTemporalLayers = n;
}
unsigned char numberOfTemporalLayers;
bool denoisingOn;
int keyFrameInterval;
@ -78,6 +88,11 @@ struct VideoCodecH264 {
bool operator!=(const VideoCodecH264& other) const {
return !(*this == other);
}
// Temporary utility method for transition deleting numberOfTemporalLayers
// setting (replaced by ScalabilityMode).
void SetNumberOfTemporalLayers(unsigned char n) {
numberOfTemporalLayers = n;
}
int keyFrameInterval;
uint8_t numberOfTemporalLayers;
};