blob: cd63f5f72b5aef39343d0422a126eeb1a1d47c4d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
phoglund@webrtc.org8bfee842012-02-17 09:32:48 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef COMMON_TYPES_H_
12#define COMMON_TYPES_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stddef.h> // For size_t
Jonas Olssona4d87372019-07-05 19:08:33 +020015
Yves Gerey988cc082018-10-23 12:03:01 +020016#include <cstdint>
17
niklase@google.com470e71d2011-07-07 08:21:25 +000018namespace webrtc {
19
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000020struct FrameCounts {
21 FrameCounts() : key_frames(0), delta_frames(0) {}
22 int key_frames;
23 int delta_frames;
24};
25
asapersson@webrtc.orgd08d3892014-12-16 12:03:11 +000026// Callback, used to notify an observer whenever frame counts have been updated.
sprang@webrtc.orgdc50aae2013-11-20 16:47:07 +000027class FrameCountObserver {
28 public:
sprang@webrtc.org72964bd2013-11-21 09:09:54 +000029 virtual ~FrameCountObserver() {}
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000030 virtual void FrameCountUpdated(const FrameCounts& frame_counts,
31 uint32_t ssrc) = 0;
sprang@webrtc.orgdc50aae2013-11-20 16:47:07 +000032};
33
niklase@google.com470e71d2011-07-07 08:21:25 +000034// ==================================================================
35// Video specific types
36// ==================================================================
37
magjede69a1a92016-11-25 10:06:31 -080038// TODO(magjed): Move this and other H264 related classes out to their own file.
39namespace H264 {
40
41enum Profile {
42 kProfileConstrainedBaseline,
43 kProfileBaseline,
44 kProfileMain,
45 kProfileConstrainedHigh,
46 kProfileHigh,
47};
48
49} // namespace H264
50
Sergey Silkin13e74342018-03-02 12:28:00 +010051struct SpatialLayer {
Niels Möllerdef1ef52018-03-19 13:48:44 +010052 bool operator==(const SpatialLayer& other) const;
53 bool operator!=(const SpatialLayer& other) const { return !(*this == other); }
54
solenberg634b86e2016-09-01 07:54:53 -070055 unsigned short width;
56 unsigned short height;
Sergey Silkin1946a3f2018-08-22 11:42:16 +020057 float maxFramerate; // fps.
solenberg634b86e2016-09-01 07:54:53 -070058 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 Hampsonf6464c92018-01-17 13:55:14 -080063 bool active; // encoded and sent.
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000064};
65
Sergey Silkin13e74342018-03-02 12:28:00 +010066// Simulcast is when the same stream is encoded multiple times with different
67// settings such as resolution.
68typedef SpatialLayer SimulcastStream;
sprangce4aef12015-11-02 07:23:20 -080069
isheriff6b4b5f32016-06-08 00:24:21 -070070// 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.
83struct PlayoutDelay {
Erik Språng56e611b2020-02-06 17:10:08 +010084 PlayoutDelay(int min_ms, int max_ms) : min_ms(min_ms), max_ms(max_ms) {}
isheriff6b4b5f32016-06-08 00:24:21 -070085 int min_ms;
86 int max_ms;
Erik Språng56e611b2020-02-06 17:10:08 +010087
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 }
isheriff6b4b5f32016-06-08 00:24:21 -070094};
95
niklase@google.com470e71d2011-07-07 08:21:25 +000096} // namespace webrtc
andrew@webrtc.orgeda189b2013-09-09 17:50:10 +000097
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020098#endif // COMMON_TYPES_H_