blob: dedcbd5460f8b26f3ce865b2f4ba92c7c79b62a6 [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
michaelt4da30442016-11-17 01:38:43 -080034// Callback, used to notify an observer when the overhead per packet
35// has changed.
36class OverheadObserver {
37 public:
38 virtual ~OverheadObserver() = default;
39 virtual void OnOverheadChanged(size_t overhead_bytes_per_packet) = 0;
40};
41
niklase@google.com470e71d2011-07-07 08:21:25 +000042// ==================================================================
43// Video specific types
44// ==================================================================
45
magjede69a1a92016-11-25 10:06:31 -080046// TODO(magjed): Move this and other H264 related classes out to their own file.
47namespace H264 {
48
49enum Profile {
50 kProfileConstrainedBaseline,
51 kProfileBaseline,
52 kProfileMain,
53 kProfileConstrainedHigh,
54 kProfileHigh,
55};
56
57} // namespace H264
58
Sergey Silkin13e74342018-03-02 12:28:00 +010059struct SpatialLayer {
Niels Möllerdef1ef52018-03-19 13:48:44 +010060 bool operator==(const SpatialLayer& other) const;
61 bool operator!=(const SpatialLayer& other) const { return !(*this == other); }
62
solenberg634b86e2016-09-01 07:54:53 -070063 unsigned short width;
64 unsigned short height;
Sergey Silkin1946a3f2018-08-22 11:42:16 +020065 float maxFramerate; // fps.
solenberg634b86e2016-09-01 07:54:53 -070066 unsigned char numberOfTemporalLayers;
67 unsigned int maxBitrate; // kilobits/sec.
68 unsigned int targetBitrate; // kilobits/sec.
69 unsigned int minBitrate; // kilobits/sec.
70 unsigned int qpMax; // minimum quality
Seth Hampsonf6464c92018-01-17 13:55:14 -080071 bool active; // encoded and sent.
pwestin@webrtc.org1da1ce02011-10-13 15:19:55 +000072};
73
Sergey Silkin13e74342018-03-02 12:28:00 +010074// Simulcast is when the same stream is encoded multiple times with different
75// settings such as resolution.
76typedef SpatialLayer SimulcastStream;
sprangce4aef12015-11-02 07:23:20 -080077
isheriff6b4b5f32016-06-08 00:24:21 -070078// Minimum and maximum playout delay values from capture to render.
79// These are best effort values.
80//
81// A value < 0 indicates no change from previous valid value.
82//
83// min = max = 0 indicates that the receiver should try and render
84// frame as soon as possible.
85//
86// min = x, max = y indicates that the receiver is free to adapt
87// in the range (x, y) based on network jitter.
88//
89// Note: Given that this gets embedded in a union, it is up-to the owner to
90// initialize these values.
91struct PlayoutDelay {
Erik Språng56e611b2020-02-06 17:10:08 +010092 PlayoutDelay(int min_ms, int max_ms) : min_ms(min_ms), max_ms(max_ms) {}
isheriff6b4b5f32016-06-08 00:24:21 -070093 int min_ms;
94 int max_ms;
Erik Språng56e611b2020-02-06 17:10:08 +010095
96 static PlayoutDelay Noop() { return PlayoutDelay(-1, -1); }
97
98 bool IsNoop() const { return min_ms == -1 && max_ms == -1; }
99 bool operator==(const PlayoutDelay& rhs) const {
100 return min_ms == rhs.min_ms && max_ms == rhs.max_ms;
101 }
isheriff6b4b5f32016-06-08 00:24:21 -0700102};
103
niklase@google.com470e71d2011-07-07 08:21:25 +0000104} // namespace webrtc
andrew@webrtc.orgeda189b2013-09-09 17:50:10 +0000105
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200106#endif // COMMON_TYPES_H_