mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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. |
| 9 | */ |
| 10 | |
pbos@webrtc.org | 16e03b7 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 11 | // TODO(pbos): Move Config from common.h to here. |
| 12 | |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 13 | #ifndef WEBRTC_CONFIG_H_ |
| 14 | #define WEBRTC_CONFIG_H_ |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 15 | |
| 16 | #include <string> |
pbos@webrtc.org | 5860de0 | 2013-09-16 13:01:47 +0000 | [diff] [blame] | 17 | #include <vector> |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 18 | |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 19 | #include "webrtc/common_types.h" |
pbos@webrtc.org | ce90eff | 2013-11-20 11:48:56 +0000 | [diff] [blame] | 20 | #include "webrtc/typedefs.h" |
| 21 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 22 | namespace webrtc { |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 23 | |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 24 | struct SsrcStats { |
| 25 | SsrcStats() |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 26 | : key_frames(0), |
| 27 | delta_frames(0), |
pbos@webrtc.org | 273a414 | 2014-12-01 15:23:21 +0000 | [diff] [blame^] | 28 | sent_width(0), |
| 29 | sent_height(0), |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 30 | total_bitrate_bps(0), |
| 31 | retransmit_bitrate_bps(0), |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 32 | avg_delay_ms(0), |
| 33 | max_delay_ms(0) {} |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 34 | uint32_t key_frames; |
| 35 | uint32_t delta_frames; |
pbos@webrtc.org | 273a414 | 2014-12-01 15:23:21 +0000 | [diff] [blame^] | 36 | int sent_width; |
| 37 | int sent_height; |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 38 | // TODO(holmer): Move bitrate_bps out to the webrtc::Call layer. |
| 39 | int total_bitrate_bps; |
| 40 | int retransmit_bitrate_bps; |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 +0000 | [diff] [blame] | 41 | int avg_delay_ms; |
| 42 | int max_delay_ms; |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 43 | StreamDataCounters rtp_stats; |
| 44 | RtcpStatistics rtcp_stats; |
sprang@webrtc.org | ccd4284 | 2014-01-07 09:54:34 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 47 | // Settings for NACK, see RFC 4585 for details. |
| 48 | struct NackConfig { |
pbos@webrtc.org | eceb532 | 2013-05-28 08:04:45 +0000 | [diff] [blame] | 49 | NackConfig() : rtp_history_ms(0) {} |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 50 | // Send side: the time RTP packets are stored for retransmissions. |
| 51 | // Receive side: the time the receiver is prepared to wait for |
| 52 | // retransmissions. |
pbos@webrtc.org | eceb532 | 2013-05-28 08:04:45 +0000 | [diff] [blame] | 53 | // Set to '0' to disable. |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 54 | int rtp_history_ms; |
| 55 | }; |
| 56 | |
| 57 | // Settings for forward error correction, see RFC 5109 for details. Set the |
| 58 | // payload types to '-1' to disable. |
| 59 | struct FecConfig { |
pbos@webrtc.org | eceb532 | 2013-05-28 08:04:45 +0000 | [diff] [blame] | 60 | FecConfig() : ulpfec_payload_type(-1), red_payload_type(-1) {} |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 61 | std::string ToString() const; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 62 | // Payload type used for ULPFEC packets. |
| 63 | int ulpfec_payload_type; |
| 64 | |
| 65 | // Payload type used for RED packets. |
| 66 | int red_payload_type; |
| 67 | }; |
| 68 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 69 | // RTP header extension to use for the video stream, see RFC 5285. |
| 70 | struct RtpExtension { |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 71 | RtpExtension(const std::string& name, int id) : name(name), id(id) {} |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 72 | std::string ToString() const; |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 73 | static bool IsSupported(const std::string& name); |
| 74 | |
pbos@webrtc.org | ce90eff | 2013-11-20 11:48:56 +0000 | [diff] [blame] | 75 | static const char* kTOffset; |
| 76 | static const char* kAbsSendTime; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 77 | std::string name; |
| 78 | int id; |
| 79 | }; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 80 | |
| 81 | struct VideoStream { |
| 82 | VideoStream() |
| 83 | : width(0), |
| 84 | height(0), |
| 85 | max_framerate(-1), |
| 86 | min_bitrate_bps(-1), |
| 87 | target_bitrate_bps(-1), |
| 88 | max_bitrate_bps(-1), |
| 89 | max_qp(-1) {} |
| 90 | std::string ToString() const; |
| 91 | |
| 92 | size_t width; |
| 93 | size_t height; |
| 94 | int max_framerate; |
| 95 | |
| 96 | int min_bitrate_bps; |
| 97 | int target_bitrate_bps; |
| 98 | int max_bitrate_bps; |
| 99 | |
| 100 | int max_qp; |
| 101 | |
pbos@webrtc.org | b7ed779 | 2014-10-31 13:08:10 +0000 | [diff] [blame] | 102 | // Bitrate thresholds for enabling additional temporal layers. Since these are |
| 103 | // thresholds in between layers, we have one additional layer. One threshold |
| 104 | // gives two temporal layers, one below the threshold and one above, two give |
| 105 | // three, and so on. |
| 106 | // The VideoEncoder may redistribute bitrates over the temporal layers so a |
| 107 | // bitrate threshold of 100k and an estimate of 105k does not imply that we |
| 108 | // get 100k in one temporal layer and 5k in the other, just that the bitrate |
| 109 | // in the first temporal layer should not exceed 100k. |
| 110 | // TODO(pbos): Apart from a special case for two-layer screencast these |
| 111 | // thresholds are not propagated to the VideoEncoder. To be implemented. |
| 112 | std::vector<int> temporal_layer_thresholds_bps; |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 +0000 | [diff] [blame] | 113 | }; |
| 114 | |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 115 | struct VideoEncoderConfig { |
| 116 | enum ContentType { |
| 117 | kRealtimeVideo, |
| 118 | kScreenshare, |
| 119 | }; |
| 120 | |
| 121 | VideoEncoderConfig() |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 122 | : content_type(kRealtimeVideo), |
| 123 | encoder_specific_settings(NULL), |
| 124 | min_transmit_bitrate_bps(0) {} |
| 125 | |
| 126 | std::string ToString() const; |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 127 | |
| 128 | std::vector<VideoStream> streams; |
| 129 | ContentType content_type; |
| 130 | void* encoder_specific_settings; |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 131 | |
| 132 | // Padding will be used up to this bitrate regardless of the bitrate produced |
| 133 | // by the encoder. Padding above what's actually produced by the encoder helps |
| 134 | // maintaining a higher bitrate estimate. Padding will however not be sent |
| 135 | // unless the estimated bandwidth indicates that the link can handle it. |
| 136 | int min_transmit_bitrate_bps; |
pbos@webrtc.org | bbe0a85 | 2014-09-19 12:30:25 +0000 | [diff] [blame] | 137 | }; |
| 138 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 139 | } // namespace webrtc |
| 140 | |
pbos@webrtc.org | 3c10758 | 2014-07-20 15:27:35 +0000 | [diff] [blame] | 141 | #endif // WEBRTC_CONFIG_H_ |