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 // Requests switch to next negotiated encoder. 27 virtual void RequestEncoderFallback() = 0; 28 29 // Requests switch to a specific encoder. If the encoder is not available and 30 // `allow_default_fallback` is `true` the default fallback is invoked. 31 virtual void RequestEncoderSwitch(const SdpVideoFormat& format, 32 bool allow_default_fallback) = 0; 33 }; 34 35 struct VideoStreamEncoderSettings { VideoStreamEncoderSettingsVideoStreamEncoderSettings36 explicit VideoStreamEncoderSettings( 37 const VideoEncoder::Capabilities& capabilities) 38 : capabilities(capabilities) {} 39 40 // Enables the new method to estimate the cpu load from encoding, used for 41 // cpu adaptation. 42 bool experiment_cpu_load_estimator = false; 43 44 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 45 VideoEncoderFactory* encoder_factory = nullptr; 46 47 // Requests the WebRtcVideoChannel to perform a codec switch. 48 EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr; 49 50 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 51 VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr; 52 53 // Negotiated capabilities which the VideoEncoder may expect the other 54 // side to use. 55 VideoEncoder::Capabilities capabilities; 56 }; 57 58 } // namespace webrtc 59 60 #endif // API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_ 61