1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 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 11 #ifndef COMMON_TYPES_H_ 12 #define COMMON_TYPES_H_ 13 14 #include <stddef.h> // For size_t 15 16 #include <cstdint> 17 18 namespace webrtc { 19 20 struct FrameCounts { FrameCountsFrameCounts21 FrameCounts() : key_frames(0), delta_frames(0) {} 22 int key_frames; 23 int delta_frames; 24 }; 25 26 // Callback, used to notify an observer whenever frame counts have been updated. 27 class FrameCountObserver { 28 public: ~FrameCountObserver()29 virtual ~FrameCountObserver() {} 30 virtual void FrameCountUpdated(const FrameCounts& frame_counts, 31 uint32_t ssrc) = 0; 32 }; 33 34 // ================================================================== 35 // Video specific types 36 // ================================================================== 37 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 51 struct SpatialLayer { 52 bool operator==(const SpatialLayer& other) const; 53 bool operator!=(const SpatialLayer& other) const { return !(*this == other); } 54 55 unsigned short width; 56 unsigned short height; 57 float maxFramerate; // fps. 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 63 bool active; // encoded and sent. 64 }; 65 66 // Simulcast is when the same stream is encoded multiple times with different 67 // settings such as resolution. 68 typedef SpatialLayer SimulcastStream; 69 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 { PlayoutDelayPlayoutDelay84 PlayoutDelay(int min_ms, int max_ms) : min_ms(min_ms), max_ms(max_ms) {} 85 int min_ms; 86 int max_ms; 87 NoopPlayoutDelay88 static PlayoutDelay Noop() { return PlayoutDelay(-1, -1); } 89 IsNoopPlayoutDelay90 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 } 94 }; 95 96 } // namespace webrtc 97 98 #endif // COMMON_TYPES_H_ 99