Niels Möller | 7992457 | 2022-07-05 14:22:27 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "api/video_codecs/simulcast_stream.h" |
| 12 | |
| 13 | #include "rtc_base/checks.h" |
| 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | unsigned char SimulcastStream::GetNumberOfTemporalLayers() const { |
| 18 | return numberOfTemporalLayers; |
| 19 | } |
Niels Möller | f2d090a | 2022-07-18 13:43:23 +0200 | [diff] [blame^] | 20 | void SimulcastStream::SetNumberOfTemporalLayers(unsigned char n) { |
| 21 | RTC_DCHECK_GE(n, 1); |
| 22 | RTC_DCHECK_LE(n, 3); |
| 23 | numberOfTemporalLayers = n; |
| 24 | } |
Niels Möller | 7992457 | 2022-07-05 14:22:27 +0200 | [diff] [blame] | 25 | |
| 26 | ScalabilityMode SimulcastStream::GetScalabilityMode() const { |
| 27 | RTC_CHECK_GE(numberOfTemporalLayers, 1); |
| 28 | RTC_CHECK_LE(numberOfTemporalLayers, 3); |
| 29 | static const ScalabilityMode scalability_modes[3] = { |
| 30 | ScalabilityMode::kL1T1, |
| 31 | ScalabilityMode::kL1T2, |
| 32 | ScalabilityMode::kL1T3, |
| 33 | }; |
| 34 | return scalability_modes[numberOfTemporalLayers - 1]; |
| 35 | } |
| 36 | |
| 37 | } // namespace webrtc |