blob: 7b6af6db9c233439a5ba3b5b196d2d317d6860d8 [file] [log] [blame]
buildbot@webrtc.orga8530772014-12-10 09:01:18 +00001/*
kjellander1afca732016-02-07 20:46:45 -08002 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
buildbot@webrtc.orga8530772014-12-10 09:01:18 +00003 *
kjellander1afca732016-02-07 20:46:45 -08004 * 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.
buildbot@webrtc.orga8530772014-12-10 09:01:18 +00009 */
jlmiller@webrtc.org5f93d0a2015-01-20 21:36:13 +000010
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MEDIA_ENGINE_SIMULCAST_H_
12#define MEDIA_ENGINE_SIMULCAST_H_
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000013
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stddef.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020015
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000016#include <vector>
17
Niels Möller0a8f4352018-05-18 11:37:23 +020018#include "api/video_codecs/video_encoder_config.h"
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000019
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000020namespace cricket {
sprang@webrtc.org46d4d292014-12-23 15:19:35 +000021
Åsa Persson55659812018-06-18 17:51:32 +020022// Gets the total maximum bitrate for the |streams|.
pbosbe16f792015-10-16 12:49:39 -070023int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& streams);
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000024
Åsa Persson55659812018-06-18 17:51:32 +020025// Adds any bitrate of |max_bitrate_bps| that is above the total maximum bitrate
26// for the |layers| to the highest quality layer.
27void BoostMaxSimulcastLayer(int max_bitrate_bps,
28 std::vector<webrtc::VideoStream>* layers);
29
Florent Castellic1a0bcb2019-01-29 14:26:48 +010030// Round size to nearest simulcast-friendly size
31int NormalizeSimulcastSize(int size, size_t simulcast_layers);
32
Åsa Persson55659812018-06-18 17:51:32 +020033// Gets simulcast settings.
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020034std::vector<webrtc::VideoStream> GetSimulcastConfig(
35 size_t max_layers,
36 int width,
37 int height,
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020038 double bitrate_priority,
39 int max_qp,
Florent Castelli66b38602019-07-10 16:57:57 +020040 bool is_screenshare_with_conference_mode,
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020041 bool temporal_layers_supported = true);
sprang429600d2017-01-26 06:12:26 -080042
Seth Hampson1370e302018-02-07 08:50:36 -080043// Gets the simulcast config layers for a non-screensharing case.
44std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
45 size_t max_layers,
46 int width,
47 int height,
Seth Hampson1370e302018-02-07 08:50:36 -080048 double bitrate_priority,
49 int max_qp,
Rasmus Brandt2b9317a2019-10-30 13:01:46 +010050 bool temporal_layers_supported,
51 bool base_heavy_tl3_rate_alloc);
Seth Hampson1370e302018-02-07 08:50:36 -080052
Åsa Persson55659812018-06-18 17:51:32 +020053// Gets simulcast config layers for screenshare settings.
Seth Hampson1370e302018-02-07 08:50:36 -080054std::vector<webrtc::VideoStream> GetScreenshareLayers(
55 size_t max_layers,
56 int width,
57 int height,
Seth Hampson1370e302018-02-07 08:50:36 -080058 double bitrate_priority,
59 int max_qp,
Rasmus Brandt2b9317a2019-10-30 13:01:46 +010060 bool temporal_layers_supported,
61 bool base_heavy_tl3_rate_alloc);
Ilya Nikolaevskiy3df1d5d2018-08-22 09:26:51 +020062
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000063} // namespace cricket
64
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020065#endif // MEDIA_ENGINE_SIMULCAST_H_