tor-browser

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

encoder_settings.cc (1979B)


      1 /*
      2 *  Copyright 2020 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 "call/adaptation/encoder_settings.h"
     12 
     13 #include <optional>
     14 #include <utility>
     15 
     16 #include "api/video/video_codec_type.h"
     17 #include "api/video_codecs/video_codec.h"
     18 #include "api/video_codecs/video_encoder.h"
     19 #include "video/config/video_encoder_config.h"
     20 
     21 namespace webrtc {
     22 
     23 EncoderSettings::EncoderSettings(VideoEncoder::EncoderInfo encoder_info,
     24                                 VideoEncoderConfig encoder_config,
     25                                 VideoCodec video_codec)
     26    : encoder_info_(std::move(encoder_info)),
     27      encoder_config_(std::move(encoder_config)),
     28      video_codec_(std::move(video_codec)) {}
     29 
     30 EncoderSettings::EncoderSettings(const EncoderSettings& other)
     31    : encoder_info_(other.encoder_info_),
     32      encoder_config_(other.encoder_config_.Copy()),
     33      video_codec_(other.video_codec_) {}
     34 
     35 EncoderSettings& EncoderSettings::operator=(const EncoderSettings& other) {
     36  encoder_info_ = other.encoder_info_;
     37  encoder_config_ = other.encoder_config_.Copy();
     38  video_codec_ = other.video_codec_;
     39  return *this;
     40 }
     41 
     42 const VideoEncoder::EncoderInfo& EncoderSettings::encoder_info() const {
     43  return encoder_info_;
     44 }
     45 
     46 const VideoEncoderConfig& EncoderSettings::encoder_config() const {
     47  return encoder_config_;
     48 }
     49 
     50 const VideoCodec& EncoderSettings::video_codec() const {
     51  return video_codec_;
     52 }
     53 
     54 VideoCodecType GetVideoCodecTypeOrGeneric(
     55    const std::optional<EncoderSettings>& settings) {
     56  return settings.has_value() ? settings->encoder_config().codec_type
     57                              : kVideoCodecGeneric;
     58 }
     59 
     60 }  // namespace webrtc