video_stream_encoder_settings.h (2323B)
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 "api/video/video_bitrate_allocator_factory.h" 15 #include "api/video_codecs/sdp_video_format.h" 16 #include "api/video_codecs/video_encoder.h" 17 #include "api/video_codecs/video_encoder_factory.h" 18 19 namespace webrtc { 20 21 class EncoderSwitchRequestCallback { 22 public: 23 virtual ~EncoderSwitchRequestCallback() {} 24 25 // Requests switch to next negotiated encoder. 26 virtual void RequestEncoderFallback() = 0; 27 28 // Requests switch to a specific encoder. If the encoder is not available and 29 // `allow_default_fallback` is `true` the default fallback is invoked. 30 virtual void RequestEncoderSwitch(const SdpVideoFormat& format, 31 bool allow_default_fallback) = 0; 32 }; 33 34 struct VideoStreamEncoderSettings { 35 explicit VideoStreamEncoderSettings( 36 const VideoEncoder::Capabilities& capabilities) 37 : capabilities(capabilities) {} 38 39 // Enables the new method to estimate the cpu load from encoding, used for 40 // cpu adaptation. 41 bool experiment_cpu_load_estimator = false; 42 43 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 44 VideoEncoderFactory* encoder_factory = nullptr; 45 46 // Requests the WebRtcVideoChannel to perform a codec switch. 47 EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr; 48 49 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection). 50 VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr; 51 52 // Negotiated capabilities which the VideoEncoder may expect the other 53 // side to use. 54 VideoEncoder::Capabilities capabilities; 55 56 // Enables the frame instrumentation generator that is required for automatic 57 // corruption detection. 58 bool enable_frame_instrumentation_generator = false; 59 }; 60 61 } // namespace webrtc 62 63 #endif // API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_