1 /* 2 * Copyright (c) 2018 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 #ifndef API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ 12 #define API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ 13 14 #include <string> 15 16 #include "api/video/video_bitrate_allocator_factory.h" 17 #include "api/video_codecs/video_encoder.h" 18 #include "api/video_codecs/video_encoder_factory.h" 19 20 namespace webrtc { 21 22 class EncoderSwitchRequestCallback { 23 public: ~EncoderSwitchRequestCallback()24 virtual ~EncoderSwitchRequestCallback() {} 25 26 struct Config { 27 std::string codec_name; 28 absl::optional<std::string> param; 29 absl::optional<std::string> value; 30 }; 31 32 // Requests that encoder fallback is performed. 33 virtual void RequestEncoderFallback() = 0; 34 35 // Requests that a switch to a specific encoder is performed. 36 virtual void RequestEncoderSwitch(const Config& conf) = 0; 37 38 virtual void RequestEncoderSwitch(const SdpVideoFormat& format) = 0; 39 }; 40 41 struct VideoStreamEncoderSettings { VideoStreamEncoderSettingsVideoStreamEncoderSettings42 explicit VideoStreamEncoderSettings( 43 const VideoEncoder::Capabilities& capabilities) 44 : capabilities(capabilities) {} 45 46 // Enables the new method to estimate the cpu load from encoding, used for 47 // cpu adaptation. 48 bool experiment_cpu_load_estimator = false; 49 50 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 51 VideoEncoderFactory* encoder_factory = nullptr; 52 53 // Requests the WebRtcVideoChannel to perform a codec switch. 54 EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr; 55 56 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 57 VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr; 58 59 // Negotiated capabilities which the VideoEncoder may expect the other 60 // side to use. 61 VideoEncoder::Capabilities capabilities; 62 }; 63 64 } // namespace webrtc 65 66 #endif // API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ 67