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/video_stream_input_state.h" 12 13 #include "api/video_codecs/video_encoder.h" 14 15 namespace webrtc { 16 VideoStreamInputState()17VideoStreamInputState::VideoStreamInputState() 18 : has_input_(false), 19 frame_size_pixels_(absl::nullopt), 20 frames_per_second_(0), 21 video_codec_type_(VideoCodecType::kVideoCodecGeneric), 22 min_pixels_per_frame_(kDefaultMinPixelsPerFrame), 23 single_active_stream_pixels_(absl::nullopt) {} 24 set_has_input(bool has_input)25void VideoStreamInputState::set_has_input(bool has_input) { 26 has_input_ = has_input; 27 } 28 set_frame_size_pixels(absl::optional<int> frame_size_pixels)29void VideoStreamInputState::set_frame_size_pixels( 30 absl::optional<int> frame_size_pixels) { 31 frame_size_pixels_ = frame_size_pixels; 32 } 33 set_frames_per_second(int frames_per_second)34void VideoStreamInputState::set_frames_per_second(int frames_per_second) { 35 frames_per_second_ = frames_per_second; 36 } 37 set_video_codec_type(VideoCodecType video_codec_type)38void VideoStreamInputState::set_video_codec_type( 39 VideoCodecType video_codec_type) { 40 video_codec_type_ = video_codec_type; 41 } 42 set_min_pixels_per_frame(int min_pixels_per_frame)43void VideoStreamInputState::set_min_pixels_per_frame(int min_pixels_per_frame) { 44 min_pixels_per_frame_ = min_pixels_per_frame; 45 } 46 set_single_active_stream_pixels(absl::optional<int> single_active_stream_pixels)47void 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 has_input() const52bool VideoStreamInputState::has_input() const { 53 return has_input_; 54 } 55 frame_size_pixels() const56absl::optional<int> VideoStreamInputState::frame_size_pixels() const { 57 return frame_size_pixels_; 58 } 59 frames_per_second() const60int VideoStreamInputState::frames_per_second() const { 61 return frames_per_second_; 62 } 63 video_codec_type() const64VideoCodecType VideoStreamInputState::video_codec_type() const { 65 return video_codec_type_; 66 } 67 min_pixels_per_frame() const68int VideoStreamInputState::min_pixels_per_frame() const { 69 return min_pixels_per_frame_; 70 } 71 single_active_stream_pixels() const72absl::optional<int> VideoStreamInputState::single_active_stream_pixels() const { 73 return single_active_stream_pixels_; 74 } 75 HasInputFrameSizeAndFramesPerSecond() const76bool VideoStreamInputState::HasInputFrameSizeAndFramesPerSecond() const { 77 return has_input_ && frame_size_pixels_.has_value(); 78 } 79 80 } // namespace webrtc 81