blob: 005c80e9443f700b4dcda4598d251ad15967b097 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "call/video_config.h"
18#include "rtc_base/basictypes.h"
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000019
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000020namespace cricket {
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000021struct StreamParams;
22
sprang429600d2017-01-26 06:12:26 -080023// TODO(sprang): Remove this, as we're moving away from temporal layer mode.
sprang@webrtc.org46d4d292014-12-23 15:19:35 +000024// Config for use with screen cast when temporal layers are enabled.
25struct ScreenshareLayerConfig {
26 public:
27 ScreenshareLayerConfig(int tl0_bitrate, int tl1_bitrate);
28
29 // Bitrates, for temporal layers 0 and 1.
30 int tl0_bitrate_kbps;
31 int tl1_bitrate_kbps;
32
33 static ScreenshareLayerConfig GetDefault();
34
35 // Parse bitrate from group name on format "(tl0_bitrate)-(tl1_bitrate)",
36 // eg. "100-1000" for the default rates.
37 static bool FromFieldTrialGroup(const std::string& group,
38 ScreenshareLayerConfig* config);
39};
40
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000041// TODO(pthatcher): Write unit tests just for these functions,
42// independent of WebrtcVideoEngine.
43
pbosbe16f792015-10-16 12:49:39 -070044int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& streams);
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000045
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000046// Get simulcast settings.
sprang429600d2017-01-26 06:12:26 -080047// TODO(sprang): Remove default parameter when it's not longer referenced.
Seth Hampson1370e302018-02-07 08:50:36 -080048std::vector<webrtc::VideoStream> GetSimulcastConfig(
49 size_t max_layers,
50 int width,
51 int height,
52 int max_bitrate_bps,
53 double bitrate_priority,
54 int max_qp,
55 int max_framerate,
56 bool is_screenshare = false);
sprang429600d2017-01-26 06:12:26 -080057
Seth Hampson1370e302018-02-07 08:50:36 -080058// Gets the simulcast config layers for a non-screensharing case.
59std::vector<webrtc::VideoStream> GetNormalSimulcastLayers(
60 size_t max_layers,
61 int width,
62 int height,
63 int max_bitrate_bps,
64 double bitrate_priority,
65 int max_qp,
66 int max_framerate);
67
68// Get simulcast config layers for screenshare settings.
69std::vector<webrtc::VideoStream> GetScreenshareLayers(
70 size_t max_layers,
71 int width,
72 int height,
73 int max_bitrate_bps,
74 double bitrate_priority,
75 int max_qp,
76 int max_framerate,
77 bool screenshare_simulcast_enabled);
78
79bool ScreenshareSimulcastFieldTrialEnabled();
buildbot@webrtc.orga8530772014-12-10 09:01:18 +000080
81} // namespace cricket
82
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020083#endif // MEDIA_ENGINE_SIMULCAST_H_