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 | |
Yves Gerey | 988cc08 | 2018-10-23 10:03:01 | [diff] [blame] | 14 | #include <stddef.h> // For size_t |
Jonas Olsson | a4d8737 | 2019-07-05 17:08:33 | [diff] [blame] | 15 | |
Yves Gerey | 988cc08 | 2018-10-23 10:03:01 | [diff] [blame] | 16 | #include <cstdint> |
| 17 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 18 | namespace webrtc { |
| 19 | |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 | [diff] [blame] | 20 | struct FrameCounts { |
| 21 | FrameCounts() : key_frames(0), delta_frames(0) {} |
| 22 | int key_frames; |
| 23 | int delta_frames; |
| 24 | }; |
| 25 | |
asapersson@webrtc.org | d08d389 | 2014-12-16 12:03:11 | [diff] [blame] | 26 | // Callback, used to notify an observer whenever frame counts have been updated. |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 27 | class FrameCountObserver { |
| 28 | public: |
sprang@webrtc.org | 72964bd | 2013-11-21 09:09:54 | [diff] [blame] | 29 | virtual ~FrameCountObserver() {} |
pbos@webrtc.org | ce4e9a3 | 2014-12-18 13:50:16 | [diff] [blame] | 30 | virtual void FrameCountUpdated(const FrameCounts& frame_counts, |
| 31 | uint32_t ssrc) = 0; |
sprang@webrtc.org | dc50aae | 2013-11-20 16:47:07 | [diff] [blame] | 32 | }; |
| 33 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 34 | // ================================================================== |
| 35 | // Video specific types |
| 36 | // ================================================================== |
| 37 | |
magjed | e69a1a9 | 2016-11-25 18:06:31 | [diff] [blame] | 38 | // TODO(magjed): Move this and other H264 related classes out to their own file. |
| 39 | namespace H264 { |
| 40 | |
| 41 | enum Profile { |
| 42 | kProfileConstrainedBaseline, |
| 43 | kProfileBaseline, |
| 44 | kProfileMain, |
| 45 | kProfileConstrainedHigh, |
| 46 | kProfileHigh, |
| 47 | }; |
| 48 | |
| 49 | } // namespace H264 |
| 50 | |
Sergey Silkin | 13e7434 | 2018-03-02 11:28:00 | [diff] [blame] | 51 | struct SpatialLayer { |
Niels Möller | def1ef5 | 2018-03-19 12:48:44 | [diff] [blame] | 52 | bool operator==(const SpatialLayer& other) const; |
| 53 | bool operator!=(const SpatialLayer& other) const { return !(*this == other); } |
| 54 | |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 55 | unsigned short width; |
| 56 | unsigned short height; |
Sergey Silkin | 1946a3f | 2018-08-22 09:42:16 | [diff] [blame] | 57 | float maxFramerate; // fps. |
solenberg | 634b86e | 2016-09-01 14:54:53 | [diff] [blame] | 58 | unsigned char numberOfTemporalLayers; |
| 59 | unsigned int maxBitrate; // kilobits/sec. |
| 60 | unsigned int targetBitrate; // kilobits/sec. |
| 61 | unsigned int minBitrate; // kilobits/sec. |
| 62 | unsigned int qpMax; // minimum quality |
Seth Hampson | f6464c9 | 2018-01-17 21:55:14 | [diff] [blame] | 63 | bool active; // encoded and sent. |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 | [diff] [blame] | 64 | }; |
| 65 | |
Sergey Silkin | 13e7434 | 2018-03-02 11:28:00 | [diff] [blame] | 66 | // Simulcast is when the same stream is encoded multiple times with different |
| 67 | // settings such as resolution. |
| 68 | typedef SpatialLayer SimulcastStream; |
sprang | ce4aef1 | 2015-11-02 15:23:20 | [diff] [blame] | 69 | |
isheriff | 6b4b5f3 | 2016-06-08 07:24:21 | [diff] [blame] | 70 | // Minimum and maximum playout delay values from capture to render. |
| 71 | // These are best effort values. |
| 72 | // |
| 73 | // A value < 0 indicates no change from previous valid value. |
| 74 | // |
| 75 | // min = max = 0 indicates that the receiver should try and render |
| 76 | // frame as soon as possible. |
| 77 | // |
| 78 | // min = x, max = y indicates that the receiver is free to adapt |
| 79 | // in the range (x, y) based on network jitter. |
| 80 | // |
| 81 | // Note: Given that this gets embedded in a union, it is up-to the owner to |
| 82 | // initialize these values. |
| 83 | struct PlayoutDelay { |
Erik Språng | 56e611b | 2020-02-06 16:10:08 | [diff] [blame] | 84 | PlayoutDelay(int min_ms, int max_ms) : min_ms(min_ms), max_ms(max_ms) {} |
isheriff | 6b4b5f3 | 2016-06-08 07:24:21 | [diff] [blame] | 85 | int min_ms; |
| 86 | int max_ms; |
Erik Språng | 56e611b | 2020-02-06 16:10:08 | [diff] [blame] | 87 | |
| 88 | static PlayoutDelay Noop() { return PlayoutDelay(-1, -1); } |
| 89 | |
| 90 | bool IsNoop() const { return min_ms == -1 && max_ms == -1; } |
| 91 | bool operator==(const PlayoutDelay& rhs) const { |
| 92 | return min_ms == rhs.min_ms && max_ms == rhs.max_ms; |
| 93 | } |
isheriff | 6b4b5f3 | 2016-06-08 07:24:21 | [diff] [blame] | 94 | }; |
| 95 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 | [diff] [blame] | 96 | } // namespace webrtc |
andrew@webrtc.org | eda189b | 2013-09-09 17:50:10 | [diff] [blame] | 97 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 98 | #endif // COMMON_TYPES_H_ |