xref: /aosp_15_r20/external/webrtc/video/config/simulcast.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #ifndef VIDEO_CONFIG_SIMULCAST_H_
12*d9f75844SAndroid Build Coastguard Worker #define VIDEO_CONFIG_SIMULCAST_H_
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #include <stddef.h>
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker #include <vector>
17*d9f75844SAndroid Build Coastguard Worker 
18*d9f75844SAndroid Build Coastguard Worker #include "api/field_trials_view.h"
19*d9f75844SAndroid Build Coastguard Worker #include "api/units/data_rate.h"
20*d9f75844SAndroid Build Coastguard Worker #include "video/config/video_encoder_config.h"
21*d9f75844SAndroid Build Coastguard Worker 
22*d9f75844SAndroid Build Coastguard Worker namespace cricket {
23*d9f75844SAndroid Build Coastguard Worker 
24*d9f75844SAndroid Build Coastguard Worker // Gets the total maximum bitrate for the `streams`.
25*d9f75844SAndroid Build Coastguard Worker webrtc::DataRate GetTotalMaxBitrate(
26*d9f75844SAndroid Build Coastguard Worker     const std::vector<webrtc::VideoStream>& streams);
27*d9f75844SAndroid Build Coastguard Worker 
28*d9f75844SAndroid Build Coastguard Worker // Adds any bitrate of `max_bitrate` that is above the total maximum bitrate for
29*d9f75844SAndroid Build Coastguard Worker // the `layers` to the highest quality layer.
30*d9f75844SAndroid Build Coastguard Worker void BoostMaxSimulcastLayer(webrtc::DataRate max_bitrate,
31*d9f75844SAndroid Build Coastguard Worker                             std::vector<webrtc::VideoStream>* layers);
32*d9f75844SAndroid Build Coastguard Worker 
33*d9f75844SAndroid Build Coastguard Worker // Round size to nearest simulcast-friendly size
34*d9f75844SAndroid Build Coastguard Worker int NormalizeSimulcastSize(int size, size_t simulcast_layers);
35*d9f75844SAndroid Build Coastguard Worker 
36*d9f75844SAndroid Build Coastguard Worker // Gets simulcast settings.
37*d9f75844SAndroid Build Coastguard Worker std::vector<webrtc::VideoStream> GetSimulcastConfig(
38*d9f75844SAndroid Build Coastguard Worker     size_t min_layers,
39*d9f75844SAndroid Build Coastguard Worker     size_t max_layers,
40*d9f75844SAndroid Build Coastguard Worker     int width,
41*d9f75844SAndroid Build Coastguard Worker     int height,
42*d9f75844SAndroid Build Coastguard Worker     double bitrate_priority,
43*d9f75844SAndroid Build Coastguard Worker     int max_qp,
44*d9f75844SAndroid Build Coastguard Worker     bool is_screenshare_with_conference_mode,
45*d9f75844SAndroid Build Coastguard Worker     bool temporal_layers_supported,
46*d9f75844SAndroid Build Coastguard Worker     const webrtc::FieldTrialsView& trials);
47*d9f75844SAndroid Build Coastguard Worker 
48*d9f75844SAndroid Build Coastguard Worker // Gets the simulcast config layers for a non-screensharing case.
49*d9f75844SAndroid Build Coastguard Worker std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
50*d9f75844SAndroid Build Coastguard Worker     size_t max_layers,
51*d9f75844SAndroid Build Coastguard Worker     int width,
52*d9f75844SAndroid Build Coastguard Worker     int height,
53*d9f75844SAndroid Build Coastguard Worker     double bitrate_priority,
54*d9f75844SAndroid Build Coastguard Worker     int max_qp,
55*d9f75844SAndroid Build Coastguard Worker     bool temporal_layers_supported,
56*d9f75844SAndroid Build Coastguard Worker     bool base_heavy_tl3_rate_alloc,
57*d9f75844SAndroid Build Coastguard Worker     const webrtc::FieldTrialsView& trials);
58*d9f75844SAndroid Build Coastguard Worker 
59*d9f75844SAndroid Build Coastguard Worker // Gets simulcast config layers for screenshare settings.
60*d9f75844SAndroid Build Coastguard Worker std::vector<webrtc::VideoStream> GetScreenshareLayers(
61*d9f75844SAndroid Build Coastguard Worker     size_t max_layers,
62*d9f75844SAndroid Build Coastguard Worker     int width,
63*d9f75844SAndroid Build Coastguard Worker     int height,
64*d9f75844SAndroid Build Coastguard Worker     double bitrate_priority,
65*d9f75844SAndroid Build Coastguard Worker     int max_qp,
66*d9f75844SAndroid Build Coastguard Worker     bool temporal_layers_supported,
67*d9f75844SAndroid Build Coastguard Worker     bool base_heavy_tl3_rate_alloc,
68*d9f75844SAndroid Build Coastguard Worker     const webrtc::FieldTrialsView& trials);
69*d9f75844SAndroid Build Coastguard Worker 
70*d9f75844SAndroid Build Coastguard Worker }  // namespace cricket
71*d9f75844SAndroid Build Coastguard Worker 
72*d9f75844SAndroid Build Coastguard Worker #endif  // VIDEO_CONFIG_SIMULCAST_H_
73