tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

simulcast_stream.cc (1680B)


      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 <optional>
     14 
     15 #include "api/video_codecs/scalability_mode.h"
     16 #include "rtc_base/checks.h"
     17 
     18 namespace webrtc {
     19 
     20 unsigned char SimulcastStream::GetNumberOfTemporalLayers() const {
     21  return numberOfTemporalLayers;
     22 }
     23 void SimulcastStream::SetNumberOfTemporalLayers(unsigned char n) {
     24  RTC_DCHECK_GE(n, 1);
     25  RTC_DCHECK_LE(n, 3);
     26  numberOfTemporalLayers = n;
     27 }
     28 
     29 std::optional<ScalabilityMode> SimulcastStream::GetScalabilityMode() const {
     30  static const ScalabilityMode scalability_modes[3] = {
     31      ScalabilityMode::kL1T1,
     32      ScalabilityMode::kL1T2,
     33      ScalabilityMode::kL1T3,
     34  };
     35  if (numberOfTemporalLayers < 1 || numberOfTemporalLayers > 3) {
     36    return std::nullopt;
     37  }
     38  return scalability_modes[numberOfTemporalLayers - 1];
     39 }
     40 
     41 bool SimulcastStream::operator==(const SimulcastStream& other) const {
     42  return (width == other.width && height == other.height &&
     43          maxFramerate == other.maxFramerate &&
     44          numberOfTemporalLayers == other.numberOfTemporalLayers &&
     45          maxBitrate == other.maxBitrate &&
     46          targetBitrate == other.targetBitrate &&
     47          minBitrate == other.minBitrate && qpMax == other.qpMax &&
     48          active == other.active);
     49 }
     50 
     51 }  // namespace webrtc