blob: 97cb196de604f026c6db73934bc5f9c7a35fae2e [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>
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000015#include <vector>
16
Niels Möller0a8f4352018-05-18 11:37:23 +020017#include "api/video_codecs/video_encoder_config.h"
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000018
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000019namespace cricket {
sprang@webrtc.org46d4d292014-12-23 15:19:35 +000020
Åsa Persson55659812018-06-18 17:51:32 +020021// Gets the total maximum bitrate for the |streams|.
pbosbe16f792015-10-16 12:49:39 -070022int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& streams);
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000023
Åsa Persson55659812018-06-18 17:51:32 +020024// Adds any bitrate of |max_bitrate_bps| that is above the total maximum bitrate
25// for the |layers| to the highest quality layer.
26void BoostMaxSimulcastLayer(int max_bitrate_bps,
27 std::vector<webrtc::VideoStream>* layers);
28
29// Gets simulcast settings.
Åsa Persson8c1bf952018-09-13 10:42:19 +020030// TODO(asapersson): Remove max_bitrate_bps and max_framerate.
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020031std::vector<webrtc::VideoStream> GetSimulcastConfig(
32 size_t max_layers,
33 int width,
34 int height,
35 int /*max_bitrate_bps*/,
36 double bitrate_priority,
37 int max_qp,
Åsa Persson8c1bf952018-09-13 10:42:19 +020038 int /*max_framerate*/,
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020039 bool is_screenshare,
40 bool temporal_layers_supported = true);
sprang429600d2017-01-26 06:12:26 -080041
Seth Hampson1370e302018-02-07 08:50:36 -080042// Gets the simulcast config layers for a non-screensharing case.
43std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
44 size_t max_layers,
45 int width,
46 int height,
Seth Hampson1370e302018-02-07 08:50:36 -080047 double bitrate_priority,
48 int max_qp,
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020049 bool temporal_layers_supported = true);
Seth Hampson1370e302018-02-07 08:50:36 -080050
Åsa Persson55659812018-06-18 17:51:32 +020051// Gets simulcast config layers for screenshare settings.
Seth Hampson1370e302018-02-07 08:50:36 -080052std::vector<webrtc::VideoStream> GetScreenshareLayers(
53 size_t max_layers,
54 int width,
55 int height,
Seth Hampson1370e302018-02-07 08:50:36 -080056 double bitrate_priority,
57 int max_qp,
Ilya Nikolaevskiy3df1d5d2018-08-22 09:26:51 +020058 bool screenshare_simulcast_enabled,
Sergio Garcia Murillo43800f92018-06-21 16:16:38 +020059 bool temporal_layers_supported = true);
Ilya Nikolaevskiy3df1d5d2018-08-22 09:26:51 +020060
61bool ScreenshareSimulcastFieldTrialEnabled();
62
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_