blob: 97af78087afff02ff32af7f9436c28aaffbeb970 [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
11#ifndef WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_
12#define WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_
13
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000014#include "webrtc/typedefs.h"
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
mikhal@webrtc.orgef9f76a2013-02-15 23:22:18 +000022enum { kMaxNumberOfFrames = 300 };
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000023enum { kStartNumberOfFrames = 6 };
pwestin@webrtc.orgd35964a2013-04-30 16:06:10 +000024enum { kMaxVideoDelayMs = 10000 };
agalusza@google.comd818dcb2013-07-29 21:48:11 +000025enum { kPacketsPerFrameMultiplier = 5 };
26enum { 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 {
mikhal@webrtc.orgf31a47a2013-08-26 17:10:11 +000039 kOutOfBoundsPacket = -7,
stefan@webrtc.org3417eb42013-05-21 15:25:53 +000040 kNotInitialized = -6,
41 kOldPacket = -5,
42 kGeneralError = -4,
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000043 kFlushIndicator = -3, // Indicator that a flush has occurred.
44 kTimeStampError = -2,
45 kSizeError = -1,
46 kNoError = 0,
47 kIncomplete = 1, // Frame incomplete.
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000048 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 {
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000054 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
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000057 kStateDecodable // Hybrid mode - frame can be decoded
niklase@google.com470e71d2011-07-07 08:21:25 +000058};
59
60enum { kH264StartCodeLengthBytes = 4};
61
62// Used to indicate if a received packet contain a complete NALU (or equivalent)
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000063enum VCMNaluCompleteness {
64 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
mikhal@webrtc.org119c67d2013-01-31 17:18:02 +000072#endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_