2022-07-05 14:22:27 +02:00
|
|
|
/*
|
|
|
|
|
* 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"
|
|
|
|
|
|
2024-02-28 16:09:24 +01:00
|
|
|
#include "absl/types/optional.h"
|
2024-08-19 01:13:31 -07:00
|
|
|
#include "api/video_codecs/scalability_mode.h"
|
2022-07-05 14:22:27 +02:00
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
unsigned char SimulcastStream::GetNumberOfTemporalLayers() const {
|
|
|
|
|
return numberOfTemporalLayers;
|
|
|
|
|
}
|
2022-07-18 13:43:23 +02:00
|
|
|
void SimulcastStream::SetNumberOfTemporalLayers(unsigned char n) {
|
|
|
|
|
RTC_DCHECK_GE(n, 1);
|
|
|
|
|
RTC_DCHECK_LE(n, 3);
|
|
|
|
|
numberOfTemporalLayers = n;
|
|
|
|
|
}
|
2022-07-05 14:22:27 +02:00
|
|
|
|
2024-02-29 08:00:33 +01:00
|
|
|
absl::optional<ScalabilityMode> SimulcastStream::GetScalabilityMode() const {
|
2022-07-05 14:22:27 +02:00
|
|
|
static const ScalabilityMode scalability_modes[3] = {
|
|
|
|
|
ScalabilityMode::kL1T1,
|
|
|
|
|
ScalabilityMode::kL1T2,
|
|
|
|
|
ScalabilityMode::kL1T3,
|
|
|
|
|
};
|
2024-02-29 08:00:33 +01:00
|
|
|
if (numberOfTemporalLayers < 1 || numberOfTemporalLayers > 3) {
|
|
|
|
|
return absl::nullopt;
|
|
|
|
|
}
|
2022-07-05 14:22:27 +02:00
|
|
|
return scalability_modes[numberOfTemporalLayers - 1];
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 06:51:44 +00:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-05 14:22:27 +02:00
|
|
|
} // namespace webrtc
|