niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 1 | /* |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef COMMON_TYPES_H_ |
| 12 | #define COMMON_TYPES_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 13 | |
pbos@webrtc.org | f577ae9 | 2014-03-19 08:43:57 | [diff] [blame] | 14 | #include <stddef.h> |
mallinath@webrtc.org | 0209e56 | 2014-03-21 00:41:28 | [diff] [blame] | 15 | #include <string.h> |
pbos@webrtc.org | 1e92b0a | 2014-05-15 09:35:06 | [diff] [blame] | 16 | #include <string> |
pbos@webrtc.org | f577ae9 | 2014-03-19 08:43:57 | [diff] [blame] | 17 | #include <vector> |
| 18 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 19 | #include "api/array_view.h" |
Erik Språng | 566124a | 2018-04-23 10:32:22 | [diff] [blame] | 20 | // TODO(sprang): Remove this include when all usage includes it directly. |
| 21 | #include "api/video/video_bitrate_allocation.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 22 | #include "rtc_base/checks.h" |
| 23 | #include "rtc_base/deprecation.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 24 | |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 25 | #if defined(_MSC_VER) |
| 26 | // Disable "new behavior: elements of array will be default initialized" |
| 27 | // warning. Affects OverUseDetectorOptions. |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 28 | #pragma warning(disable : 4351) |
andrew@webrtc.org | 88b8b0d | 2012-08-14 00:05:56 | [diff] [blame] | 29 | #endif |
| 30 | |
Peter Boström | 8b79b07 | 2016-02-26 15:31:37 | [diff] [blame] | 31 | #define RTP_PAYLOAD_NAME_SIZE 32u |
henrika@webrtc.org | f75901f | 2012-01-16 08:45:42 | [diff] [blame] | 32 | |
mallinath@webrtc.org | 0209e56 | 2014-03-21 00:41:28 | [diff] [blame] | 33 | #if defined(WEBRTC_WIN) || defined(WIN32) |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 34 | // Compares two strings without regard to case. |
| 35 | #define STR_CASE_CMP(s1, s2) ::_stricmp(s1, s2) |
| 36 | // Compares characters of two strings without regard to case. |
| 37 | #define STR_NCASE_CMP(s1, s2, n) ::_strnicmp(s1, s2, n) |
| 38 | #else |
| 39 | #define STR_CASE_CMP(s1, s2) ::strcasecmp(s1, s2) |
| 40 | #define STR_NCASE_CMP(s1, s2, n) ::strncasecmp(s1, s2, n) |
| 41 | #endif |
| 42 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 43 | namespace webrtc { |
| 44 | |
pbos | 22993e1 | 2015-10-19 09:39:06 | [diff] [blame] | 45 | enum FrameType { |
| 46 | kEmptyFrame = 0, |
| 47 | kAudioFrameSpeech = 1, |
| 48 | kAudioFrameCN = 2, |
| 49 | kVideoFrameKey = 3, |
| 50 | kVideoFrameDelta = 4, |
sprang@webrtc.org | 71f055f | 2013-12-04 15:09:27 | [diff] [blame] | 51 | }; |
| 52 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 53 | // Statistics for an RTCP channel |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 54 | struct RtcpStatistics { |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 55 | RtcpStatistics() |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 56 | : fraction_lost(0), |
srte | 186d9c3 | 2017-08-04 12:03:53 | [diff] [blame] | 57 | packets_lost(0), |
| 58 | extended_highest_sequence_number(0), |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 59 | jitter(0) {} |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 60 | |
| 61 | uint8_t fraction_lost; |
Danil Chapovalov | 3daabad | 2018-08-15 15:12:12 | [diff] [blame] | 62 | int32_t packets_lost; // Defined as a 24 bit signed integer in RTCP |
| 63 | uint32_t extended_highest_sequence_number; |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 64 | uint32_t jitter; |
sprang@webrtc.org | fe5d36b | 2013-10-28 09:21:07 | [diff] [blame] | 65 | }; |
| 66 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 67 | class RtcpStatisticsCallback { |
| 68 | public: |
| 69 | virtual ~RtcpStatisticsCallback() {} |
| 70 | |
| 71 | virtual void StatisticsUpdated(const RtcpStatistics& statistics, |
| 72 | uint32_t ssrc) = 0; |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 | [diff] [blame] | 73 | virtual void CNameChanged(const char* cname, uint32_t ssrc) = 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 74 | }; |
| 75 | |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 | [diff] [blame] | 76 | // Statistics for RTCP packet types. |
| 77 | struct RtcpPacketTypeCounter { |
| 78 | RtcpPacketTypeCounter() |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 79 | : first_packet_time_ms(-1), |
| 80 | nack_packets(0), |
| 81 | fir_packets(0), |
| 82 | pli_packets(0), |
| 83 | nack_requests(0), |
| 84 | unique_nack_requests(0) {} |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 | [diff] [blame] | 85 | |
| 86 | void Add(const RtcpPacketTypeCounter& other) { |
| 87 | nack_packets += other.nack_packets; |
| 88 | fir_packets += other.fir_packets; |
| 89 | pli_packets += other.pli_packets; |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 | [diff] [blame] | 90 | nack_requests += other.nack_requests; |
| 91 | unique_nack_requests += other.unique_nack_requests; |
asapersson@webrtc.org | d08d389 | 2014-12-16 12:03:11 | [diff] [blame] | 92 | if (other.first_packet_time_ms != -1 && |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 93 | (other.first_packet_time_ms < first_packet_time_ms || |
| 94 | first_packet_time_ms == -1)) { |
asapersson@webrtc.org | d08d389 | 2014-12-16 12:03:11 | [diff] [blame] | 95 | // Use oldest time. |
| 96 | first_packet_time_ms = other.first_packet_time_ms; |
| 97 | } |
| 98 | } |
| 99 | |
sprang | 07fb9be | 2016-02-24 15:55:00 | [diff] [blame] | 100 | void Subtract(const RtcpPacketTypeCounter& other) { |
| 101 | nack_packets -= other.nack_packets; |
| 102 | fir_packets -= other.fir_packets; |
| 103 | pli_packets -= other.pli_packets; |
| 104 | nack_requests -= other.nack_requests; |
| 105 | unique_nack_requests -= other.unique_nack_requests; |
| 106 | if (other.first_packet_time_ms != -1 && |
| 107 | (other.first_packet_time_ms > first_packet_time_ms || |
| 108 | first_packet_time_ms == -1)) { |
| 109 | // Use youngest time. |
| 110 | first_packet_time_ms = other.first_packet_time_ms; |
| 111 | } |
| 112 | } |
| 113 | |
asapersson@webrtc.org | d08d389 | 2014-12-16 12:03:11 | [diff] [blame] | 114 | int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const { |
| 115 | return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms); |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 | [diff] [blame] | 116 | } |
| 117 | |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 | [diff] [blame] | 118 | int UniqueNackRequestsInPercent() const { |
| 119 | if (nack_requests == 0) { |
| 120 | return 0; |
| 121 | } |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 122 | return static_cast<int>((unique_nack_requests * 100.0f / nack_requests) + |
| 123 | 0.5f); |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 | [diff] [blame] | 124 | } |
| 125 | |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 126 | int64_t first_packet_time_ms; // Time when first packet is sent/received. |
| 127 | uint32_t nack_packets; // Number of RTCP NACK packets. |
| 128 | uint32_t fir_packets; // Number of RTCP FIR packets. |
| 129 | uint32_t pli_packets; // Number of RTCP PLI packets. |
| 130 | uint32_t nack_requests; // Number of NACKed RTP packets. |
asapersson@webrtc.org | 2dd3134 | 2014-10-29 12:42:30 | [diff] [blame] | 131 | uint32_t unique_nack_requests; // Number of unique NACKed RTP packets. |
asapersson@webrtc.org | 8098e07 | 2014-02-19 11:59:02 | [diff] [blame] | 132 | }; |
| 133 | |
pbos@webrtc.org | 1d0fa5d | 2015-02-19 12:47:00 | [diff] [blame] | 134 | class RtcpPacketTypeCounterObserver { |
| 135 | public: |
| 136 | virtual ~RtcpPacketTypeCounterObserver() {} |
| 137 | virtual void RtcpPacketTypesCounterUpdated( |
| 138 | uint32_t ssrc, |
| 139 | const RtcpPacketTypeCounter& packet_counter) = 0; |
| 140 | }; |
| 141 | |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 142 | // Callback, used to notify an observer whenever new rates have been estimated. |
| 143 | class BitrateStatisticsObserver { |
| 144 | public: |
| 145 | virtual ~BitrateStatisticsObserver() {} |
| 146 | |
sprang | cd349d9 | 2016-07-13 16:11:28 | [diff] [blame] | 147 | virtual void Notify(uint32_t total_bitrate_bps, |
| 148 | uint32_t retransmit_bitrate_bps, |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 | [diff] [blame] | 149 | uint32_t ssrc) = 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 150 | }; |
| 151 | |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 | [diff] [blame] | 152 | struct FrameCounts { |
| 153 | FrameCounts() : key_frames(0), delta_frames(0) {} |
| 154 | int key_frames; |
| 155 | int delta_frames; |
| 156 | }; |
| 157 | |
asapersson@webrtc.org | d08d389 | 2014-12-16 12:03:11 | [diff] [blame] | 158 | // Callback, used to notify an observer whenever frame counts have been updated. |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 159 | class FrameCountObserver { |
| 160 | public: |
sprang@webrtc.org | 72964bd | 2013-11-21 09:09:54 | [diff] [blame] | 161 | virtual ~FrameCountObserver() {} |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 | [diff] [blame] | 162 | virtual void FrameCountUpdated(const FrameCounts& frame_counts, |
| 163 | uint32_t ssrc) = 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 164 | }; |
| 165 | |
stefan@webrtc.org | 168f23f | 2014-07-11 13:44:02 | [diff] [blame] | 166 | // Callback, used to notify an observer whenever the send-side delay is updated. |
| 167 | class SendSideDelayObserver { |
| 168 | public: |
| 169 | virtual ~SendSideDelayObserver() {} |
| 170 | virtual void SendSideDelayUpdated(int avg_delay_ms, |
| 171 | int max_delay_ms, |
| 172 | uint32_t ssrc) = 0; |
| 173 | }; |
| 174 | |
asapersson | 35151f3 | 2016-05-03 06:44:01 | [diff] [blame] | 175 | // Callback, used to notify an observer whenever a packet is sent to the |
| 176 | // transport. |
| 177 | // TODO(asapersson): This class will remove the need for SendSideDelayObserver. |
| 178 | // Remove SendSideDelayObserver once possible. |
| 179 | class SendPacketObserver { |
| 180 | public: |
| 181 | virtual ~SendPacketObserver() {} |
| 182 | virtual void OnSendPacket(uint16_t packet_id, |
| 183 | int64_t capture_time_ms, |
| 184 | uint32_t ssrc) = 0; |
| 185 | }; |
| 186 | |
michaelt | 4da3044 | 2016-11-17 09:38:43 | [diff] [blame] | 187 | // Callback, used to notify an observer when the overhead per packet |
| 188 | // has changed. |
| 189 | class OverheadObserver { |
| 190 | public: |
| 191 | virtual ~OverheadObserver() = default; |
| 192 | virtual void OnOverheadChanged(size_t overhead_bytes_per_packet) = 0; |
| 193 | }; |
| 194 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 195 | // ================================================================== |
| 196 | // Voice specific types |
| 197 | // ================================================================== |
| 198 | |
| 199 | // Each codec supported can be described by this structure. |
mallinath@webrtc.org | 0209e56 | 2014-03-21 00:41:28 | [diff] [blame] | 200 | struct CodecInst { |
| 201 | int pltype; |
| 202 | char plname[RTP_PAYLOAD_NAME_SIZE]; |
| 203 | int plfreq; |
| 204 | int pacsize; |
Peter Kasting | 6955870 | 2016-01-13 00:26:35 | [diff] [blame] | 205 | size_t channels; |
mallinath@webrtc.org | 0209e56 | 2014-03-21 00:41:28 | [diff] [blame] | 206 | int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file! |
| 207 | |
| 208 | bool operator==(const CodecInst& other) const { |
| 209 | return pltype == other.pltype && |
| 210 | (STR_CASE_CMP(plname, other.plname) == 0) && |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 211 | plfreq == other.plfreq && pacsize == other.pacsize && |
| 212 | channels == other.channels && rate == other.rate; |
mallinath@webrtc.org | 0209e56 | 2014-03-21 00:41:28 | [diff] [blame] | 213 | } |
| 214 | |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 215 | bool operator!=(const CodecInst& other) const { return !(*this == other); } |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 216 | }; |
| 217 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 218 | // RTP |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 219 | enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 220 | |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 221 | // NETEQ statistics. |
| 222 | struct NetworkStatistics { |
| 223 | // current jitter buffer size in ms |
| 224 | uint16_t currentBufferSize; |
| 225 | // preferred (optimal) buffer size in ms |
| 226 | uint16_t preferredBufferSize; |
| 227 | // adding extra delay due to "peaky jitter" |
| 228 | bool jitterPeaksFound; |
Gustaf Ullberg | b0a0207 | 2017-10-02 10:00:34 | [diff] [blame] | 229 | // Stats below correspond to similarly-named fields in the WebRTC stats spec. |
| 230 | // https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats |
Steve Anton | 2dbc69f | 2017-08-25 00:15:13 | [diff] [blame] | 231 | uint64_t totalSamplesReceived; |
Steve Anton | 2dbc69f | 2017-08-25 00:15:13 | [diff] [blame] | 232 | uint64_t concealedSamples; |
Gustaf Ullberg | 9a2e906 | 2017-09-18 07:28:20 | [diff] [blame] | 233 | uint64_t concealmentEvents; |
Gustaf Ullberg | b0a0207 | 2017-10-02 10:00:34 | [diff] [blame] | 234 | uint64_t jitterBufferDelayMs; |
| 235 | // Stats below DO NOT correspond directly to anything in the WebRTC stats |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 236 | // Loss rate (network + late); fraction between 0 and 1, scaled to Q14. |
| 237 | uint16_t currentPacketLossRate; |
| 238 | // Late loss rate; fraction between 0 and 1, scaled to Q14. |
minyue-webrtc | 0c3ca75 | 2017-08-23 13:59:38 | [diff] [blame] | 239 | union { |
| 240 | RTC_DEPRECATED uint16_t currentDiscardRate; |
| 241 | }; |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 242 | // fraction (of original stream) of synthesized audio inserted through |
| 243 | // expansion (in Q14) |
| 244 | uint16_t currentExpandRate; |
| 245 | // fraction (of original stream) of synthesized speech inserted through |
| 246 | // expansion (in Q14) |
| 247 | uint16_t currentSpeechExpandRate; |
| 248 | // fraction of synthesized speech inserted through pre-emptive expansion |
| 249 | // (in Q14) |
| 250 | uint16_t currentPreemptiveRate; |
| 251 | // fraction of data removed through acceleration (in Q14) |
| 252 | uint16_t currentAccelerateRate; |
| 253 | // fraction of data coming from secondary decoding (in Q14) |
| 254 | uint16_t currentSecondaryDecodedRate; |
minyue-webrtc | 0e320ec | 2017-08-28 11:51:27 | [diff] [blame] | 255 | // Fraction of secondary data, including FEC and RED, that is discarded (in |
| 256 | // Q14). Discarding of secondary data can be caused by the reception of the |
| 257 | // primary data, obsoleting the secondary data. It can also be caused by early |
| 258 | // or late arrival of secondary data. |
minyue-webrtc | 0c3ca75 | 2017-08-23 13:59:38 | [diff] [blame] | 259 | uint16_t currentSecondaryDiscardedRate; |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 260 | // clock-drift in parts-per-million (negative or positive) |
| 261 | int32_t clockDriftPPM; |
| 262 | // average packet waiting time in the jitter buffer (ms) |
| 263 | int meanWaitingTimeMs; |
| 264 | // median packet waiting time in the jitter buffer (ms) |
| 265 | int medianWaitingTimeMs; |
| 266 | // min packet waiting time in the jitter buffer (ms) |
| 267 | int minWaitingTimeMs; |
| 268 | // max packet waiting time in the jitter buffer (ms) |
| 269 | int maxWaitingTimeMs; |
| 270 | // added samples in off mode due to packet loss |
| 271 | size_t addedSamples; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 272 | }; |
| 273 | |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 | [diff] [blame] | 274 | // Statistics for calls to AudioCodingModule::PlayoutData10Ms(). |
| 275 | struct AudioDecodingCallStats { |
| 276 | AudioDecodingCallStats() |
| 277 | : calls_to_silence_generator(0), |
| 278 | calls_to_neteq(0), |
| 279 | decoded_normal(0), |
| 280 | decoded_plc(0), |
| 281 | decoded_cng(0), |
henrik.lundin | 6348978 | 2016-09-20 08:47:12 | [diff] [blame] | 282 | decoded_plc_cng(0), |
| 283 | decoded_muted_output(0) {} |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 | [diff] [blame] | 284 | |
| 285 | int calls_to_silence_generator; // Number of calls where silence generated, |
| 286 | // and NetEq was disengaged from decoding. |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 287 | int calls_to_neteq; // Number of calls to NetEq. |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 | [diff] [blame] | 288 | int decoded_normal; // Number of calls where audio RTP packet decoded. |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 289 | int decoded_plc; // Number of calls resulted in PLC. |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 | [diff] [blame] | 290 | int decoded_cng; // Number of calls where comfort noise generated due to DTX. |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 291 | int decoded_plc_cng; // Number of calls resulted where PLC faded to CNG. |
henrik.lundin | 6348978 | 2016-09-20 08:47:12 | [diff] [blame] | 292 | int decoded_muted_output; // Number of calls returning a muted state output. |
wu@webrtc.org | 24301a6 | 2013-12-13 19:17:43 | [diff] [blame] | 293 | }; |
| 294 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 295 | // ================================================================== |
| 296 | // Video specific types |
| 297 | // ================================================================== |
| 298 | |
nisse | eb44b39 | 2017-04-28 14:18:05 | [diff] [blame] | 299 | // TODO(nisse): Delete, and switch to fourcc values everywhere? |
| 300 | // Supported video types. |
| 301 | enum class VideoType { |
| 302 | kUnknown, |
| 303 | kI420, |
| 304 | kIYUV, |
| 305 | kRGB24, |
| 306 | kABGR, |
| 307 | kARGB, |
| 308 | kARGB4444, |
| 309 | kRGB565, |
| 310 | kARGB1555, |
| 311 | kYUY2, |
| 312 | kYV12, |
| 313 | kUYVY, |
| 314 | kMJPEG, |
| 315 | kNV21, |
| 316 | kNV12, |
| 317 | kBGRA, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 318 | }; |
| 319 | |
magjed | e69a1a9 | 2016-11-25 18:06:31 | [diff] [blame] | 320 | // TODO(magjed): Move this and other H264 related classes out to their own file. |
| 321 | namespace H264 { |
| 322 | |
| 323 | enum Profile { |
| 324 | kProfileConstrainedBaseline, |
| 325 | kProfileBaseline, |
| 326 | kProfileMain, |
| 327 | kProfileConstrainedHigh, |
| 328 | kProfileHigh, |
| 329 | }; |
| 330 | |
| 331 | } // namespace H264 |
| 332 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 333 | // Video codec types |
marpan@webrtc.org | 5b88317 | 2014-11-01 06:10:48 | [diff] [blame] | 334 | enum VideoCodecType { |
Niels Möller | 520ca4e | 2018-06-04 09:14:38 | [diff] [blame] | 335 | // There are various memset(..., 0, ...) calls in the code that rely on |
Kári Tristan Helgason | 84ccb2d | 2018-08-16 12:35:26 | [diff] [blame] | 336 | // kVideoCodecGeneric being zero. |
| 337 | kVideoCodecGeneric = 0, |
marpan@webrtc.org | 5b88317 | 2014-11-01 06:10:48 | [diff] [blame] | 338 | kVideoCodecVP8, |
| 339 | kVideoCodecVP9, |
| 340 | kVideoCodecH264, |
| 341 | kVideoCodecI420, |
Emircan Uysaler | d7ae3c3 | 2018-01-25 21:01:09 | [diff] [blame] | 342 | kVideoCodecMultiplex, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 343 | }; |
| 344 | |
Sergey Silkin | 13e7434 | 2018-03-02 11:28:00 | [diff] [blame] | 345 | struct SpatialLayer { |
Niels Möller | def1ef5 | 2018-03-19 12:48:44 | [diff] [blame] | 346 | bool operator==(const SpatialLayer& other) const; |
| 347 | bool operator!=(const SpatialLayer& other) const { return !(*this == other); } |
| 348 | |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 349 | unsigned short width; |
| 350 | unsigned short height; |
Sergey Silkin | 1946a3f | 2018-08-22 09:42:16 | [diff] [blame] | 351 | float maxFramerate; // fps. |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 352 | unsigned char numberOfTemporalLayers; |
| 353 | unsigned int maxBitrate; // kilobits/sec. |
| 354 | unsigned int targetBitrate; // kilobits/sec. |
| 355 | unsigned int minBitrate; // kilobits/sec. |
| 356 | unsigned int qpMax; // minimum quality |
Seth Hampson | f6464c9 | 2018-01-17 21:55:14 | [diff] [blame] | 357 | bool active; // encoded and sent. |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 358 | }; |
| 359 | |
Sergey Silkin | 13e7434 | 2018-03-02 11:28:00 | [diff] [blame] | 360 | // Simulcast is when the same stream is encoded multiple times with different |
| 361 | // settings such as resolution. |
| 362 | typedef SpatialLayer SimulcastStream; |
sprang | ce4aef1 | 2015-11-02 15:23:20 | [diff] [blame] | 363 | |
Erik Språng | 566124a | 2018-04-23 10:32:22 | [diff] [blame] | 364 | // TODO(sprang): Remove this when downstream projects have been updated. |
| 365 | using BitrateAllocation = VideoBitrateAllocation; |
Erik Språng | 08127a9 | 2016-11-16 15:41:30 | [diff] [blame] | 366 | |
stefan | 64c0a0a | 2015-11-27 09:02:31 | [diff] [blame] | 367 | // Bandwidth over-use detector options. These are used to drive |
| 368 | // experimentation with bandwidth estimation parameters. |
| 369 | // See modules/remote_bitrate_estimator/overuse_detector.h |
terelius | 84f83f8 | 2016-12-27 18:43:01 | [diff] [blame] | 370 | // TODO(terelius): This is only used in overuse_estimator.cc, and only in the |
| 371 | // default constructed state. Can we move the relevant variables into that |
| 372 | // class and delete this? See also disabled warning at line 27 |
stefan | 64c0a0a | 2015-11-27 09:02:31 | [diff] [blame] | 373 | struct OverUseDetectorOptions { |
| 374 | OverUseDetectorOptions() |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 375 | : initial_slope(8.0 / 512.0), |
stefan | 64c0a0a | 2015-11-27 09:02:31 | [diff] [blame] | 376 | initial_offset(0), |
| 377 | initial_e(), |
| 378 | initial_process_noise(), |
| 379 | initial_avg_noise(0.0), |
| 380 | initial_var_noise(50) { |
| 381 | initial_e[0][0] = 100; |
| 382 | initial_e[1][1] = 1e-1; |
| 383 | initial_e[0][1] = initial_e[1][0] = 0; |
| 384 | initial_process_noise[0] = 1e-13; |
stefan | 1069cac | 2016-03-10 13:13:21 | [diff] [blame] | 385 | initial_process_noise[1] = 1e-3; |
stefan | 64c0a0a | 2015-11-27 09:02:31 | [diff] [blame] | 386 | } |
| 387 | double initial_slope; |
| 388 | double initial_offset; |
| 389 | double initial_e[2][2]; |
| 390 | double initial_process_noise[2]; |
| 391 | double initial_avg_noise; |
| 392 | double initial_var_noise; |
| 393 | }; |
| 394 | |
isheriff | 6b4b5f3 | 2016-06-08 07:24:21 | [diff] [blame] | 395 | // Minimum and maximum playout delay values from capture to render. |
| 396 | // These are best effort values. |
| 397 | // |
| 398 | // A value < 0 indicates no change from previous valid value. |
| 399 | // |
| 400 | // min = max = 0 indicates that the receiver should try and render |
| 401 | // frame as soon as possible. |
| 402 | // |
| 403 | // min = x, max = y indicates that the receiver is free to adapt |
| 404 | // in the range (x, y) based on network jitter. |
| 405 | // |
| 406 | // Note: Given that this gets embedded in a union, it is up-to the owner to |
| 407 | // initialize these values. |
| 408 | struct PlayoutDelay { |
| 409 | int min_ms; |
| 410 | int max_ms; |
| 411 | }; |
| 412 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 413 | } // namespace webrtc |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 414 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 415 | #endif // COMMON_TYPES_H_ |