blob: c156899c1a9f560ca7be09148ca42627c3dc91d6 [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
15#include <cstdint>
16
niklase@google.com470e71d2011-07-07 08:21:25 +000017namespace webrtc {
18
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000019struct FrameCounts {
20 FrameCounts() : key_frames(0), delta_frames(0) {}
21 int key_frames;
22 int delta_frames;
23};
24
asapersson@webrtc.orgd08d3892014-12-16 12:03:11 +000025// Callback, used to notify an observer whenever frame counts have been updated.
sprang@webrtc.orgdc50aae2013-11-20 16:47:07 +000026class FrameCountObserver {
27 public:
sprang@webrtc.org72964bd2013-11-21 09:09:54 +000028 virtual ~FrameCountObserver() {}
pbos@webrtc.orgce4e9a32014-12-18 13:50:16 +000029 virtual void FrameCountUpdated(const FrameCounts& frame_counts,
30 uint32_t ssrc) = 0;
sprang@webrtc.orgdc50aae2013-11-20 16:47:07 +000031};
32
michaelt4da30442016-11-17 01:38:43 -080033// Callback, used to notify an observer when the overhead per packet
34// has changed.
35class OverheadObserver {
36 public:
37 virtual ~OverheadObserver() = default;
38 virtual void OnOverheadChanged(size_t overhead_bytes_per_packet) = 0;
39};
40
niklase@google.com470e71d2011-07-07 08:21:25 +000041// ==================================================================
42// Video specific types
43// ==================================================================
44
magjede69a1a92016-11-25 10:06:31 -080045// TODO(magjed): Move this and other H264 related classes out to their own file.
46namespace H264 {
47
48enum Profile {
49 kProfileConstrainedBaseline,
50 kProfileBaseline,
51 kProfileMain,
52 kProfileConstrainedHigh,
53 kProfileHigh,
54};
55
56} // namespace H264
57
Sergey Silkin13e74342018-03-02 12:28:00 +010058struct SpatialLayer {
Niels Möllerdef1ef52018-03-19 13:48:44 +010059 bool operator==(const SpatialLayer& other) const;
60 bool operator!=(const SpatialLayer& other) const { return !(*this == other); }
61
solenberg634b86e2016-09-01 07:54:53 -070062 unsigned short width;
63 unsigned short height;
Sergey Silkin1946a3f2018-08-22 11:42:16 +020064 float maxFramerate; // fps.
solenberg634b86e2016-09-01 07:54:53 -070065 unsigned char numberOfTemporalLayers;
66 unsigned int maxBitrate; // kilobits/sec.
67 unsigned int targetBitrate; // kilobits/sec.
68 unsigned int minBitrate; // kilobits/sec.
69 unsigned int qpMax; // minimum quality
Seth Hampsonf6464c92018-01-17 13:55:14 -080070 bool active; // encoded and sent.
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000071};
72
Sergey Silkin13e74342018-03-02 12:28:00 +010073// Simulcast is when the same stream is encoded multiple times with different
74// settings such as resolution.
75typedef SpatialLayer SimulcastStream;
sprangce4aef12015-11-02 07:23:20 -080076
isheriff6b4b5f32016-06-08 00:24:21 -070077// Minimum and maximum playout delay values from capture to render.
78// These are best effort values.
79//
80// A value < 0 indicates no change from previous valid value.
81//
82// min = max = 0 indicates that the receiver should try and render
83// frame as soon as possible.
84//
85// min = x, max = y indicates that the receiver is free to adapt
86// in the range (x, y) based on network jitter.
87//
88// Note: Given that this gets embedded in a union, it is up-to the owner to
89// initialize these values.
90struct PlayoutDelay {
91 int min_ms;
92 int max_ms;
93};
94
niklase@google.com470e71d2011-07-07 08:21:25 +000095} // namespace webrtc
andrew@webrtc.orgeda189b2013-09-09 17:50:10 +000096
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020097#endif // COMMON_TYPES_H_