blob: 257ebc0eacb058ef5c4618d658757f1ae652929a [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_
12#define MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Mirko Bonadei71207422017-09-15 13:58:09 +020014#include "typedefs.h" // NOLINT(build/include)
stefan@webrtc.org4c059d82011-10-13 07:35:37 +000015
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000016namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000017
agalusza@google.comd818dcb2013-07-29 21:48:11 +000018// Used to estimate rolling average of packets per frame.
19static const float kFastConvergeMultiplier = 0.4f;
20static const float kNormalConvergeMultiplier = 0.2f;
21
philipel9d3ab612015-12-21 04:12:39 -080022enum { kMaxNumberOfFrames = 300 };
23enum { kStartNumberOfFrames = 6 };
24enum { kMaxVideoDelayMs = 10000 };
agalusza@google.comd818dcb2013-07-29 21:48:11 +000025enum { kPacketsPerFrameMultiplier = 5 };
philipel9d3ab612015-12-21 04:12:39 -080026enum { kFastConvergeThreshold = 5 };
niklase@google.com470e71d2011-07-07 08:21:25 +000027
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000028enum VCMJitterBufferEnum {
sprang907dcfd2015-08-05 01:09:11 -070029 kMaxConsecutiveOldFrames = 60,
30 kMaxConsecutiveOldPackets = 300,
31 // TODO(sprang): Reduce this limit once codecs don't sometimes wildly
32 // overshoot bitrate target.
33 kMaxPacketsInSession = 1400, // Allows ~2MB frames.
34 kBufferIncStepSizeBytes = 30000, // >20 packets.
35 kMaxJBFrameSizeBytes = 4000000 // sanity don't go above 4Mbyte.
niklase@google.com470e71d2011-07-07 08:21:25 +000036};
37
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000038enum VCMFrameBufferEnum {
philipel9d3ab612015-12-21 04:12:39 -080039 kOutOfBoundsPacket = -7,
40 kNotInitialized = -6,
41 kOldPacket = -5,
42 kGeneralError = -4,
43 kFlushIndicator = -3, // Indicator that a flush has occurred.
44 kTimeStampError = -2,
45 kSizeError = -1,
46 kNoError = 0,
47 kIncomplete = 1, // Frame incomplete.
48 kCompleteSession = 3, // at least one layer in the frame complete.
49 kDecodableSession = 4, // Frame incomplete, but ready to be decoded
50 kDuplicatePacket = 5 // We're receiving a duplicate packet.
niklase@google.com470e71d2011-07-07 08:21:25 +000051};
52
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000053enum VCMFrameBufferStateEnum {
philipel9d3ab612015-12-21 04:12:39 -080054 kStateEmpty, // frame popped by the RTP receiver
55 kStateIncomplete, // frame that have one or more packet(s) stored
56 kStateComplete, // frame that have all packets
57 kStateDecodable // Hybrid mode - frame can be decoded
niklase@google.com470e71d2011-07-07 08:21:25 +000058};
59
philipel9d3ab612015-12-21 04:12:39 -080060enum { kH264StartCodeLengthBytes = 4 };
niklase@google.com470e71d2011-07-07 08:21:25 +000061
62// Used to indicate if a received packet contain a complete NALU (or equivalent)
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000063enum VCMNaluCompleteness {
philipel9d3ab612015-12-21 04:12:39 -080064 kNaluUnset = 0, // Packet has not been filled.
65 kNaluComplete = 1, // Packet can be decoded as is.
66 kNaluStart, // Packet contain beginning of NALU
67 kNaluIncomplete, // Packet is not beginning or end of NALU
68 kNaluEnd, // Packet is the end of a NALU
niklase@google.com470e71d2011-07-07 08:21:25 +000069};
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000070} // namespace webrtc
stefan@webrtc.org4c059d82011-10-13 07:35:37 +000071
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020072#endif // MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_