video_stream_encoder_settings.h 2.1 KB

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