blob: 4997327971b0dea92d284cc749ef21e0e5bc5fec [file] [log] [blame]
Niels Möller213618e2018-07-24 09:29:58 +02001/*
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
philipeld9cc8c02019-09-16 14:53:40 +020014#include <string>
15
Jiawei Ouc2ebe212018-11-08 10:02:56 -080016#include "api/video/video_bitrate_allocator_factory.h"
Elad Alon370f93a2019-06-11 14:57:57 +020017#include "api/video_codecs/video_encoder.h"
Niels Möller213618e2018-07-24 09:29:58 +020018#include "api/video_codecs/video_encoder_factory.h"
19
20namespace webrtc {
21
philipeld9cc8c02019-09-16 14:53:40 +020022class EncoderSwitchRequestCallback {
philipele8ed8302019-07-03 11:53:48 +020023 public:
philipeld9cc8c02019-09-16 14:53:40 +020024 virtual ~EncoderSwitchRequestCallback() {}
25
26 struct Config {
27 std::string codec_name;
28 absl::optional<std::string> param;
29 absl::optional<std::string> value;
30 };
31
32 // Requests that encoder fallback is performed.
33 virtual void RequestEncoderFallback() = 0;
34
35 // Requests that a switch to a specific encoder is performed.
36 virtual void RequestEncoderSwitch(const Config& conf) = 0;
philipele8ed8302019-07-03 11:53:48 +020037};
38
Niels Möller213618e2018-07-24 09:29:58 +020039struct VideoStreamEncoderSettings {
Elad Alon370f93a2019-06-11 14:57:57 +020040 explicit VideoStreamEncoderSettings(
41 const VideoEncoder::Capabilities& capabilities)
42 : capabilities(capabilities) {}
Niels Möller213618e2018-07-24 09:29:58 +020043
44 // Enables the new method to estimate the cpu load from encoding, used for
45 // cpu adaptation.
46 bool experiment_cpu_load_estimator = false;
47
48 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
49 VideoEncoderFactory* encoder_factory = nullptr;
Jiawei Ouc2ebe212018-11-08 10:02:56 -080050
philipeld9cc8c02019-09-16 14:53:40 +020051 // Requests the WebRtcVideoChannel to perform a codec switch.
52 EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr;
philipele8ed8302019-07-03 11:53:48 +020053
Jiawei Ouc2ebe212018-11-08 10:02:56 -080054 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
55 VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr;
Elad Alon370f93a2019-06-11 14:57:57 +020056
57 // Negotiated capabilities which the VideoEncoder may expect the other
58 // side to use.
59 VideoEncoder::Capabilities capabilities;
Niels Möller213618e2018-07-24 09:29:58 +020060};
61
62} // namespace webrtc
63
64#endif // API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_