blob: 3aee5b70509c51e5c1a49f6d4b2fc6396a6195a0 [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
Sergey Silkine1cd3ad2022-01-21 11:35:04 +010026 // Requests switch to next negotiated encoder.
philipeld9cc8c02019-09-16 14:53:40 +020027 virtual void RequestEncoderFallback() = 0;
28
Sergey Silkine1cd3ad2022-01-21 11:35:04 +010029 // Requests switch to a specific encoder. If the encoder is not available and
30 // `allow_default_fallback` is `true` the default fallback is invoked.
31 virtual void RequestEncoderSwitch(const SdpVideoFormat& format,
32 bool allow_default_fallback) = 0;
philipele8ed8302019-07-03 11:53:48 +020033};
34
Niels Möller213618e2018-07-24 09:29:58 +020035struct VideoStreamEncoderSettings {
Elad Alon370f93a2019-06-11 14:57:57 +020036 explicit VideoStreamEncoderSettings(
37 const VideoEncoder::Capabilities& capabilities)
38 : capabilities(capabilities) {}
Niels Möller213618e2018-07-24 09:29:58 +020039
40 // Enables the new method to estimate the cpu load from encoding, used for
41 // cpu adaptation.
42 bool experiment_cpu_load_estimator = false;
43
44 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
45 VideoEncoderFactory* encoder_factory = nullptr;
Jiawei Ouc2ebe212018-11-08 10:02:56 -080046
philipeld9cc8c02019-09-16 14:53:40 +020047 // Requests the WebRtcVideoChannel to perform a codec switch.
48 EncoderSwitchRequestCallback* encoder_switch_request_callback = nullptr;
philipele8ed8302019-07-03 11:53:48 +020049
Jiawei Ouc2ebe212018-11-08 10:02:56 -080050 // Ownership stays with WebrtcVideoEngine (delegated from PeerConnection).
51 VideoBitrateAllocatorFactory* bitrate_allocator_factory = nullptr;
Elad Alon370f93a2019-06-11 14:57:57 +020052
53 // Negotiated capabilities which the VideoEncoder may expect the other
54 // side to use.
55 VideoEncoder::Capabilities capabilities;
Niels Möller213618e2018-07-24 09:29:58 +020056};
57
58} // namespace webrtc
59
60#endif // API_VIDEO_VIDEO_STREAM_ENCODER_SETTINGS_H_