aboutsummaryrefslogtreecommitdiff
path: root/api/video_codecs/video_encoder_factory.h
diff options
context:
space:
mode:
Diffstat (limited to 'api/video_codecs/video_encoder_factory.h')
-rw-r--r--api/video_codecs/video_encoder_factory.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/api/video_codecs/video_encoder_factory.h b/api/video_codecs/video_encoder_factory.h
index 22430eb19d..c2d66cfa86 100644
--- a/api/video_codecs/video_encoder_factory.h
+++ b/api/video_codecs/video_encoder_factory.h
@@ -12,6 +12,7 @@
#define API_VIDEO_CODECS_VIDEO_ENCODER_FACTORY_H_
#include <memory>
+#include <string>
#include <vector>
#include "absl/types/optional.h"
@@ -36,6 +37,11 @@ class VideoEncoderFactory {
bool has_internal_source = false;
};
+ struct CodecSupport {
+ bool is_supported = false;
+ bool is_power_efficient = false;
+ };
+
// An injectable class that is continuously updated with encoding conditions
// and selects the best encoder given those conditions.
class EncoderSelectorInterface {
@@ -78,6 +84,26 @@ class VideoEncoderFactory {
return CodecInfo();
}
+ // Query whether the specifed format is supported or not and if it will be
+ // power efficient, which is currently interpreted as if there is support for
+ // hardware acceleration.
+ // See https://w3c.github.io/webrtc-svc/#scalabilitymodes* for a specification
+ // of valid values for |scalability_mode|.
+ // NOTE: QueryCodecSupport is currently an experimental feature that is
+ // subject to change without notice.
+ virtual CodecSupport QueryCodecSupport(
+ const SdpVideoFormat& format,
+ absl::optional<std::string> scalability_mode) const {
+ // Default implementation, query for supported formats and check if the
+ // specified format is supported. Returns false if scalability_mode is
+ // specified.
+ CodecSupport codec_support;
+ if (!scalability_mode) {
+ codec_support.is_supported = format.IsCodecInList(GetSupportedFormats());
+ }
+ return codec_support;
+ }
+
// Creates a VideoEncoder for the specified format.
virtual std::unique_ptr<VideoEncoder> CreateVideoEncoder(
const SdpVideoFormat& format) = 0;