blob: 9c0d47590274139f70ebbadcfb03e3d7f25a2acf [file] [log] [blame]
Henrik Boströmd516b252020-04-17 12:10:59 +02001/*
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/video_stream_input_state.h"
12
13#include "api/video_codecs/video_encoder.h"
14
15namespace webrtc {
16
17VideoStreamInputState::VideoStreamInputState()
18 : has_input_(false),
19 frame_size_pixels_(absl::nullopt),
Henrik Boström722fa4d2020-04-29 16:46:30 +020020 frames_per_second_(0),
Henrik Boströmd516b252020-04-17 12:10:59 +020021 video_codec_type_(VideoCodecType::kVideoCodecGeneric),
Åsa Persson1dd94a02021-02-18 14:20:03 +010022 min_pixels_per_frame_(kDefaultMinPixelsPerFrame),
23 single_active_stream_pixels_(absl::nullopt) {}
Henrik Boströmd516b252020-04-17 12:10:59 +020024
25void VideoStreamInputState::set_has_input(bool has_input) {
26 has_input_ = has_input;
27}
28
29void VideoStreamInputState::set_frame_size_pixels(
30 absl::optional<int> frame_size_pixels) {
31 frame_size_pixels_ = frame_size_pixels;
32}
33
Henrik Boström722fa4d2020-04-29 16:46:30 +020034void VideoStreamInputState::set_frames_per_second(int frames_per_second) {
Henrik Boströmd516b252020-04-17 12:10:59 +020035 frames_per_second_ = frames_per_second;
36}
37
38void VideoStreamInputState::set_video_codec_type(
39 VideoCodecType video_codec_type) {
40 video_codec_type_ = video_codec_type;
41}
42
43void VideoStreamInputState::set_min_pixels_per_frame(int min_pixels_per_frame) {
44 min_pixels_per_frame_ = min_pixels_per_frame;
45}
46
Åsa Persson1dd94a02021-02-18 14:20:03 +010047void VideoStreamInputState::set_single_active_stream_pixels(
48 absl::optional<int> single_active_stream_pixels) {
49 single_active_stream_pixels_ = single_active_stream_pixels;
50}
51
Henrik Boströmd516b252020-04-17 12:10:59 +020052bool VideoStreamInputState::has_input() const {
53 return has_input_;
54}
55
56absl::optional<int> VideoStreamInputState::frame_size_pixels() const {
57 return frame_size_pixels_;
58}
59
Henrik Boström722fa4d2020-04-29 16:46:30 +020060int VideoStreamInputState::frames_per_second() const {
Henrik Boströmd516b252020-04-17 12:10:59 +020061 return frames_per_second_;
62}
63
64VideoCodecType VideoStreamInputState::video_codec_type() const {
65 return video_codec_type_;
66}
67
68int VideoStreamInputState::min_pixels_per_frame() const {
69 return min_pixels_per_frame_;
70}
71
Åsa Persson1dd94a02021-02-18 14:20:03 +010072absl::optional<int> VideoStreamInputState::single_active_stream_pixels() const {
73 return single_active_stream_pixels_;
74}
75
Henrik Boströmd516b252020-04-17 12:10:59 +020076bool VideoStreamInputState::HasInputFrameSizeAndFramesPerSecond() const {
Henrik Boström722fa4d2020-04-29 16:46:30 +020077 return has_input_ && frame_size_pixels_.has_value();
Henrik Boströmd516b252020-04-17 12:10:59 +020078}
79
80} // namespace webrtc