1 /* 2 * Copyright (c) 2016 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_CODECS_VIDEO_ENCODER_SOFTWARE_FALLBACK_WRAPPER_H_ 12 #define API_VIDEO_CODECS_VIDEO_ENCODER_SOFTWARE_FALLBACK_WRAPPER_H_ 13 14 #include <memory> 15 #include <utility> 16 17 #include "api/video_codecs/video_encoder.h" 18 #include "rtc_base/system/rtc_export.h" 19 20 namespace webrtc { 21 22 // Used to wrap external VideoEncoders to provide a fallback option on 23 // software encoding when a hardware encoder fails to encode a stream due to 24 // hardware restrictions, such as max resolution. 25 // |bool prefer_temporal_support| indicates that if the software fallback 26 // encoder supports temporal layers but the hardware encoder does not, a 27 // fallback should be forced even if the encoder otherwise works. 28 RTC_EXPORT std::unique_ptr<VideoEncoder> 29 CreateVideoEncoderSoftwareFallbackWrapper( 30 std::unique_ptr<VideoEncoder> sw_fallback_encoder, 31 std::unique_ptr<VideoEncoder> hw_encoder, 32 bool prefer_temporal_support); 33 34 // Default fallback for call-sites not yet updated with 35 // |prefer_temporal_support|. 36 // TODO(sprang): Remove when usage is gone. 37 RTC_EXPORT inline std::unique_ptr<VideoEncoder> CreateVideoEncoderSoftwareFallbackWrapper(std::unique_ptr<VideoEncoder> sw_fallback_encoder,std::unique_ptr<VideoEncoder> hw_encoder)38CreateVideoEncoderSoftwareFallbackWrapper( 39 std::unique_ptr<VideoEncoder> sw_fallback_encoder, 40 std::unique_ptr<VideoEncoder> hw_encoder) { 41 return CreateVideoEncoderSoftwareFallbackWrapper( 42 std::move(sw_fallback_encoder), std::move(hw_encoder), false); 43 } 44 45 } // namespace webrtc 46 47 #endif // API_VIDEO_CODECS_VIDEO_ENCODER_SOFTWARE_FALLBACK_WRAPPER_H_ 48