xref: /aosp_15_r20/external/webrtc/api/video_codecs/simulcast_stream.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
GetNumberOfTemporalLayers() const17 unsigned char SimulcastStream::GetNumberOfTemporalLayers() const {
18   return numberOfTemporalLayers;
19 }
SetNumberOfTemporalLayers(unsigned char n)20 void SimulcastStream::SetNumberOfTemporalLayers(unsigned char n) {
21   RTC_DCHECK_GE(n, 1);
22   RTC_DCHECK_LE(n, 3);
23   numberOfTemporalLayers = n;
24 }
25 
GetScalabilityMode() const26 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
38