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 set_has_input(bool has_input)24void VideoStreamInputState::set_has_input(bool has_input) { 25 has_input_ = has_input; 26 } 27 set_frame_size_pixels(absl::optional<int> frame_size_pixels)28void VideoStreamInputState::set_frame_size_pixels( 29 absl::optional<int> frame_size_pixels) { 30 frame_size_pixels_ = frame_size_pixels; 31 } 32 set_frames_per_second(int frames_per_second)33void VideoStreamInputState::set_frames_per_second(int frames_per_second) { 34 frames_per_second_ = frames_per_second; 35 } 36 set_video_codec_type(VideoCodecType video_codec_type)37void VideoStreamInputState::set_video_codec_type( 38 VideoCodecType video_codec_type) { 39 video_codec_type_ = video_codec_type; 40 } 41 set_min_pixels_per_frame(int min_pixels_per_frame)42void VideoStreamInputState::set_min_pixels_per_frame(int min_pixels_per_frame) { 43 min_pixels_per_frame_ = min_pixels_per_frame; 44 } 45 has_input() const46bool VideoStreamInputState::has_input() const { 47 return has_input_; 48 } 49 frame_size_pixels() const50absl::optional<int> VideoStreamInputState::frame_size_pixels() const { 51 return frame_size_pixels_; 52 } 53 frames_per_second() const54int VideoStreamInputState::frames_per_second() const { 55 return frames_per_second_; 56 } 57 video_codec_type() const58VideoCodecType VideoStreamInputState::video_codec_type() const { 59 return video_codec_type_; 60 } 61 min_pixels_per_frame() const62int VideoStreamInputState::min_pixels_per_frame() const { 63 return min_pixels_per_frame_; 64 } 65 HasInputFrameSizeAndFramesPerSecond() const66bool VideoStreamInputState::HasInputFrameSizeAndFramesPerSecond() const { 67 return has_input_ && frame_size_pixels_.has_value(); 68 } 69 70 } // namespace webrtc 71