Henrik Boström | b0f2e0c | 2020-03-06 12:32:03 | [diff] [blame] | 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 | |
| 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 | |
Henrik Boström | 453953c | 2020-03-14 09:53:57 | [diff] [blame] | 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 | |
| 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 | |
Henrik Boström | b0f2e0c | 2020-03-06 12:32:03 | [diff] [blame] | 36 | const VideoEncoder::EncoderInfo& EncoderSettings::encoder_info() const { |
| 37 | return encoder_info_; |
| 38 | } |
| 39 | |
| 40 | const VideoEncoderConfig& EncoderSettings::encoder_config() const { |
| 41 | return encoder_config_; |
| 42 | } |
| 43 | |
| 44 | const VideoCodec& EncoderSettings::video_codec() const { |
| 45 | return video_codec_; |
| 46 | } |
| 47 | |
| 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 |