blob: c894e833ed5bd2df326e972a7dff7f2ca060e534 [file] [log] [blame]
Henrik Boströmb0f2e0c2020-03-06 12:32:031/*
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
15namespace webrtc {
16
17EncoderSettings::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
Henrik Boström453953c2020-03-14 09:53:5724EncoderSettings::EncoderSettings(const EncoderSettings& other)
25 : encoder_info_(other.encoder_info_),
26 encoder_config_(other.encoder_config_.Copy()),
27 video_codec_(other.video_codec_) {}
28
29EncoderSettings& 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
Henrik Boströmb0f2e0c2020-03-06 12:32:0336const VideoEncoder::EncoderInfo& EncoderSettings::encoder_info() const {
37 return encoder_info_;
38}
39
40const VideoEncoderConfig& EncoderSettings::encoder_config() const {
41 return encoder_config_;
42}
43
44const VideoCodec& EncoderSettings::video_codec() const {
45 return video_codec_;
46}
47
48VideoCodecType GetVideoCodecTypeOrGeneric(
49 const absl::optional<EncoderSettings>& settings) {
50 return settings.has_value() ? settings->encoder_config().codec_type
51 : kVideoCodecGeneric;
52}
53
54} // namespace webrtc