1/*
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
14#include "webrtc/typedefs.h"
15
16namespace webrtc {
17
18// Used to estimate rolling average of packets per frame.
19static const float kFastConvergeMultiplier = 0.4f;
20static const float kNormalConvergeMultiplier = 0.2f;
21
22enum { kMaxNumberOfFrames     = 300 };
23enum { kStartNumberOfFrames   = 6 };
24enum { kMaxVideoDelayMs       = 10000 };
25enum { kPacketsPerFrameMultiplier = 5 };
26enum { kFastConvergeThreshold = 5};
27
28enum VCMJitterBufferEnum {
29  kMaxConsecutiveOldFrames        = 60,
30  kMaxConsecutiveOldPackets       = 300,
31  kMaxPacketsInSession            = 800,
32  kBufferIncStepSizeBytes         = 30000,   // >20 packets.
33  kMaxJBFrameSizeBytes            = 4000000  // sanity don't go above 4Mbyte.
34};
35
36enum VCMFrameBufferEnum {
37  kOutOfBoundsPacket    = -7,
38  kNotInitialized       = -6,
39  kOldPacket            = -5,
40  kGeneralError         = -4,
41  kFlushIndicator       = -3,   // Indicator that a flush has occurred.
42  kTimeStampError       = -2,
43  kSizeError            = -1,
44  kNoError              = 0,
45  kIncomplete           = 1,    // Frame incomplete.
46  kCompleteSession      = 3,    // at least one layer in the frame complete.
47  kDecodableSession     = 4,    // Frame incomplete, but ready to be decoded
48  kDuplicatePacket      = 5     // We're receiving a duplicate packet.
49};
50
51enum VCMFrameBufferStateEnum {
52  kStateEmpty,              // frame popped by the RTP receiver
53  kStateIncomplete,         // frame that have one or more packet(s) stored
54  kStateComplete,           // frame that have all packets
55  kStateDecodable           // Hybrid mode - frame can be decoded
56};
57
58enum { kH264StartCodeLengthBytes = 4};
59
60// Used to indicate if a received packet contain a complete NALU (or equivalent)
61enum VCMNaluCompleteness {
62  kNaluUnset = 0,       // Packet has not been filled.
63  kNaluComplete = 1,    // Packet can be decoded as is.
64  kNaluStart,           // Packet contain beginning of NALU
65  kNaluIncomplete,      // Packet is not beginning or end of NALU
66  kNaluEnd,             // Packet is the end of a NALU
67};
68}  // namespace webrtc
69
70#endif  // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_
71