• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <utility>
14 
15 namespace webrtc {
16 
EncoderSettings(VideoEncoder::EncoderInfo encoder_info,VideoEncoderConfig encoder_config,VideoCodec video_codec)17 EncoderSettings::EncoderSettings(VideoEncoder::EncoderInfo encoder_info,
18                                  VideoEncoderConfig encoder_config,
19                                  VideoCodec video_codec)
20     : encoder_info_(std::move(encoder_info)),
21       encoder_config_(std::move(encoder_config)),
22       video_codec_(std::move(video_codec)) {}
23 
EncoderSettings(const EncoderSettings & other)24 EncoderSettings::EncoderSettings(const EncoderSettings& other)
25     : encoder_info_(other.encoder_info_),
26       encoder_config_(other.encoder_config_.Copy()),
27       video_codec_(other.video_codec_) {}
28 
operator =(const EncoderSettings & other)29 EncoderSettings& EncoderSettings::operator=(const EncoderSettings& other) {
30   encoder_info_ = other.encoder_info_;
31   encoder_config_ = other.encoder_config_.Copy();
32   video_codec_ = other.video_codec_;
33   return *this;
34 }
35 
encoder_info() const36 const VideoEncoder::EncoderInfo& EncoderSettings::encoder_info() const {
37   return encoder_info_;
38 }
39 
encoder_config() const40 const VideoEncoderConfig& EncoderSettings::encoder_config() const {
41   return encoder_config_;
42 }
43 
video_codec() const44 const VideoCodec& EncoderSettings::video_codec() const {
45   return video_codec_;
46 }
47 
GetVideoCodecTypeOrGeneric(const absl::optional<EncoderSettings> & settings)48 VideoCodecType GetVideoCodecTypeOrGeneric(
49     const absl::optional<EncoderSettings>& settings) {
50   return settings.has_value() ? settings->encoder_config().codec_type
51                               : kVideoCodecGeneric;
52 }
53 
54 }  // namespace webrtc
55