blob: 3172f5e01f9f401f7ec2f8777758866aa8a51117 [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
Steve Antone78bcb92017-10-31 09:53:08 -070014#include <string>
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
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000021// TODO(pthatcher): Write unit tests just for these functions,
22// independent of WebrtcVideoEngine.
23
Åsa Persson55659812018-06-18 17:51:32 +020024// Gets the total maximum bitrate for the |streams|.
pbosbe16f792015-10-16 12:49:39 -070025int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& streams);
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000026
Åsa Persson55659812018-06-18 17:51:32 +020027// Adds any bitrate of |max_bitrate_bps| that is above the total maximum bitrate
28// for the |layers| to the highest quality layer.
29void BoostMaxSimulcastLayer(int max_bitrate_bps,
30 std::vector<webrtc::VideoStream>* layers);
31
32// Gets simulcast settings.
33// TODO(asapersson): Remove max_bitrate_bps.
34std::vector<webrtc::VideoStream> GetSimulcastConfig(size_t max_layers,
35 int width,
36 int height,
37 int /*max_bitrate_bps*/,
38 double bitrate_priority,
39 int max_qp,
40 int max_framerate,
41 bool is_screenshare);
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,
50 int max_framerate);
51
Åsa Persson55659812018-06-18 17:51:32 +020052// Gets simulcast config layers for screenshare settings.
Seth Hampson1370e302018-02-07 08:50:36 -080053std::vector<webrtc::VideoStream> GetScreenshareLayers(
54 size_t max_layers,
55 int width,
56 int height,
Seth Hampson1370e302018-02-07 08:50:36 -080057 double bitrate_priority,
58 int max_qp,
59 int max_framerate,
60 bool screenshare_simulcast_enabled);
61
62bool ScreenshareSimulcastFieldTrialEnabled();
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000063
64} // namespace cricket
65
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020066#endif // MEDIA_ENGINE_SIMULCAST_H_