buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 1 | /* |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 3 | * |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 4 | * 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.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 9 | */ |
jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MEDIA_ENGINE_SIMULCAST_H_ |
| 12 | #define MEDIA_ENGINE_SIMULCAST_H_ |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 13 | |
Steve Anton | e78bcb9 | 2017-10-31 09:53:08 -0700 | [diff] [blame] | 14 | #include <string> |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 15 | #include <vector> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "call/video_config.h" |
| 18 | #include "rtc_base/basictypes.h" |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 19 | |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 20 | namespace cricket { |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 21 | struct StreamParams; |
| 22 | |
sprang | 429600d | 2017-01-26 06:12:26 -0800 | [diff] [blame] | 23 | // TODO(sprang): Remove this, as we're moving away from temporal layer mode. |
sprang@webrtc.org | 46d4d29 | 2014-12-23 15:19:35 +0000 | [diff] [blame] | 24 | // Config for use with screen cast when temporal layers are enabled. |
| 25 | struct 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.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 41 | // TODO(pthatcher): Write unit tests just for these functions, |
| 42 | // independent of WebrtcVideoEngine. |
| 43 | |
pbos | be16f79 | 2015-10-16 12:49:39 -0700 | [diff] [blame] | 44 | int GetTotalMaxBitrateBps(const std::vector<webrtc::VideoStream>& streams); |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 45 | |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 46 | // Get simulcast settings. |
sprang | 429600d | 2017-01-26 06:12:26 -0800 | [diff] [blame] | 47 | // TODO(sprang): Remove default parameter when it's not longer referenced. |
Seth Hampson | 1370e30 | 2018-02-07 08:50:36 -0800 | [diff] [blame^] | 48 | std::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); |
sprang | 429600d | 2017-01-26 06:12:26 -0800 | [diff] [blame] | 57 | |
Seth Hampson | 1370e30 | 2018-02-07 08:50:36 -0800 | [diff] [blame^] | 58 | // Gets the simulcast config layers for a non-screensharing case. |
| 59 | std::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. |
| 69 | std::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 | |
| 79 | bool ScreenshareSimulcastFieldTrialEnabled(); |
buildbot@webrtc.org | a853077 | 2014-12-10 09:01:18 +0000 | [diff] [blame] | 80 | |
| 81 | } // namespace cricket |
| 82 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 83 | #endif // MEDIA_ENGINE_SIMULCAST_H_ |