OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ |
13 | 13 |
14 #include "webrtc/typedefs.h" | 14 #include "webrtc/typedefs.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 // Used to estimate rolling average of packets per frame. | 18 // Used to estimate rolling average of packets per frame. |
19 static const float kFastConvergeMultiplier = 0.4f; | 19 static const float kFastConvergeMultiplier = 0.4f; |
20 static const float kNormalConvergeMultiplier = 0.2f; | 20 static const float kNormalConvergeMultiplier = 0.2f; |
21 | 21 |
22 enum { kMaxNumberOfFrames = 300 }; | 22 enum { kMaxNumberOfFrames = 300 }; |
23 enum { kStartNumberOfFrames = 6 }; | 23 enum { kStartNumberOfFrames = 6 }; |
24 enum { kMaxVideoDelayMs = 10000 }; | 24 enum { kMaxVideoDelayMs = 10000 }; |
25 enum { kPacketsPerFrameMultiplier = 5 }; | 25 enum { kPacketsPerFrameMultiplier = 5 }; |
26 enum { kFastConvergeThreshold = 5}; | 26 enum { kFastConvergeThreshold = 5 }; |
27 | 27 |
28 enum VCMJitterBufferEnum { | 28 enum VCMJitterBufferEnum { |
29 kMaxConsecutiveOldFrames = 60, | 29 kMaxConsecutiveOldFrames = 60, |
30 kMaxConsecutiveOldPackets = 300, | 30 kMaxConsecutiveOldPackets = 300, |
31 // TODO(sprang): Reduce this limit once codecs don't sometimes wildly | 31 // TODO(sprang): Reduce this limit once codecs don't sometimes wildly |
32 // overshoot bitrate target. | 32 // overshoot bitrate target. |
33 kMaxPacketsInSession = 1400, // Allows ~2MB frames. | 33 kMaxPacketsInSession = 1400, // Allows ~2MB frames. |
34 kBufferIncStepSizeBytes = 30000, // >20 packets. | 34 kBufferIncStepSizeBytes = 30000, // >20 packets. |
35 kMaxJBFrameSizeBytes = 4000000 // sanity don't go above 4Mbyte. | 35 kMaxJBFrameSizeBytes = 4000000 // sanity don't go above 4Mbyte. |
36 }; | 36 }; |
37 | 37 |
38 enum VCMFrameBufferEnum { | 38 enum VCMFrameBufferEnum { |
39 kOutOfBoundsPacket = -7, | 39 kOutOfBoundsPacket = -7, |
40 kNotInitialized = -6, | 40 kNotInitialized = -6, |
41 kOldPacket = -5, | 41 kOldPacket = -5, |
42 kGeneralError = -4, | 42 kGeneralError = -4, |
43 kFlushIndicator = -3, // Indicator that a flush has occurred. | 43 kFlushIndicator = -3, // Indicator that a flush has occurred. |
44 kTimeStampError = -2, | 44 kTimeStampError = -2, |
45 kSizeError = -1, | 45 kSizeError = -1, |
46 kNoError = 0, | 46 kNoError = 0, |
47 kIncomplete = 1, // Frame incomplete. | 47 kIncomplete = 1, // Frame incomplete. |
48 kCompleteSession = 3, // at least one layer in the frame complete. | 48 kCompleteSession = 3, // at least one layer in the frame complete. |
49 kDecodableSession = 4, // Frame incomplete, but ready to be decoded | 49 kDecodableSession = 4, // Frame incomplete, but ready to be decoded |
50 kDuplicatePacket = 5 // We're receiving a duplicate packet. | 50 kDuplicatePacket = 5 // We're receiving a duplicate packet. |
51 }; | 51 }; |
52 | 52 |
53 enum VCMFrameBufferStateEnum { | 53 enum VCMFrameBufferStateEnum { |
54 kStateEmpty, // frame popped by the RTP receiver | 54 kStateEmpty, // frame popped by the RTP receiver |
55 kStateIncomplete, // frame that have one or more packet(s) stored | 55 kStateIncomplete, // frame that have one or more packet(s) stored |
56 kStateComplete, // frame that have all packets | 56 kStateComplete, // frame that have all packets |
57 kStateDecodable // Hybrid mode - frame can be decoded | 57 kStateDecodable // Hybrid mode - frame can be decoded |
58 }; | 58 }; |
59 | 59 |
60 enum { kH264StartCodeLengthBytes = 4}; | 60 enum { kH264StartCodeLengthBytes = 4 }; |
61 | 61 |
62 // Used to indicate if a received packet contain a complete NALU (or equivalent) | 62 // Used to indicate if a received packet contain a complete NALU (or equivalent) |
63 enum VCMNaluCompleteness { | 63 enum VCMNaluCompleteness { |
64 kNaluUnset = 0, // Packet has not been filled. | 64 kNaluUnset = 0, // Packet has not been filled. |
65 kNaluComplete = 1, // Packet can be decoded as is. | 65 kNaluComplete = 1, // Packet can be decoded as is. |
66 kNaluStart, // Packet contain beginning of NALU | 66 kNaluStart, // Packet contain beginning of NALU |
67 kNaluIncomplete, // Packet is not beginning or end of NALU | 67 kNaluIncomplete, // Packet is not beginning or end of NALU |
68 kNaluEnd, // Packet is the end of a NALU | 68 kNaluEnd, // Packet is the end of a NALU |
69 }; | 69 }; |
70 } // namespace webrtc | 70 } // namespace webrtc |
71 | 71 |
72 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ | 72 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_COMMON_H_ |
OLD | NEW |