OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 void ManageFrame(std::unique_ptr<RtpFrameObject> frame); | 50 void ManageFrame(std::unique_ptr<RtpFrameObject> frame); |
51 | 51 |
52 // Notifies that padding has been received, which the reference finder | 52 // Notifies that padding has been received, which the reference finder |
53 // might need to calculate the references of a frame. | 53 // might need to calculate the references of a frame. |
54 void PaddingReceived(uint16_t seq_num); | 54 void PaddingReceived(uint16_t seq_num); |
55 | 55 |
56 // Clear all stashed frames that include packets older than |seq_num|. | 56 // Clear all stashed frames that include packets older than |seq_num|. |
57 void ClearTo(uint16_t seq_num); | 57 void ClearTo(uint16_t seq_num); |
58 | 58 |
59 private: | 59 private: |
60 static const uint16_t kPicIdLength = 1 << 7; | 60 static const uint16_t kPicIdLength = 1 << 15; |
61 static const uint8_t kMaxTemporalLayers = 5; | 61 static const uint8_t kMaxTemporalLayers = 5; |
62 static const int kMaxLayerInfo = 10; | 62 static const int kMaxLayerInfo = 50; |
63 static const int kMaxStashedFrames = 10; | 63 static const int kMaxStashedFrames = 50; |
64 static const int kMaxNotYetReceivedFrames = 20; | 64 static const int kMaxNotYetReceivedFrames = 100; |
65 static const int kMaxGofSaved = 15; | 65 static const int kMaxGofSaved = 50; |
66 static const int kMaxPaddingAge = 100; | 66 static const int kMaxPaddingAge = 100; |
67 | 67 |
68 | 68 |
69 struct GofInfo { | 69 struct GofInfo { |
70 GofInfo(GofInfoVP9* gof, uint16_t last_picture_id) | 70 GofInfo(GofInfoVP9* gof, uint16_t last_picture_id) |
71 : gof(gof), last_picture_id(last_picture_id) {} | 71 : gof(gof), last_picture_id(last_picture_id) {} |
72 GofInfoVP9* gof; | 72 GofInfoVP9* gof; |
73 uint16_t last_picture_id; | 73 uint16_t last_picture_id; |
74 }; | 74 }; |
75 | 75 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 122 |
123 // Check if there is a frame with the up-switch flag set in the interval | 123 // Check if there is a frame with the up-switch flag set in the interval |
124 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. | 124 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. |
125 bool UpSwitchInIntervalVp9(uint16_t picture_id, | 125 bool UpSwitchInIntervalVp9(uint16_t picture_id, |
126 uint8_t temporal_idx, | 126 uint8_t temporal_idx, |
127 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 127 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
128 | 128 |
129 // All picture ids are unwrapped to 16 bits. | 129 // All picture ids are unwrapped to 16 bits. |
130 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 130 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
131 | 131 |
132 // Returns true if the frame is old and should be dropped. | |
133 // TODO(philipel): Remove when VP9 PID does not jump mid-stream. | |
stefan-webrtc
2016/11/14 12:00:26
M59 timeframe?
philipel
2016/11/14 15:31:04
Added comment.
| |
134 bool Vp9PidTl0Fix(const RtpFrameObject& frame, | |
135 int16_t* picture_id, | |
136 int16_t* tl0_pic_idx) EXCLUSIVE_LOCKS_REQUIRED(crit_); | |
132 | 137 |
133 // For every group of pictures, hold two sequence numbers. The first being | 138 // For every group of pictures, hold two sequence numbers. The first being |
134 // the sequence number of the last packet of the last completed frame, and | 139 // the sequence number of the last packet of the last completed frame, and |
135 // the second being the sequence number of the last packet of the last | 140 // the second being the sequence number of the last packet of the last |
136 // completed frame advanced by any potential continuous packets of padding. | 141 // completed frame advanced by any potential continuous packets of padding. |
137 std::map<uint16_t, | 142 std::map<uint16_t, |
138 std::pair<uint16_t, uint16_t>, | 143 std::pair<uint16_t, uint16_t>, |
139 DescendingSeqNumComp<uint16_t>> | 144 DescendingSeqNumComp<uint16_t>> |
140 last_seq_num_gop_ GUARDED_BY(crit_); | 145 last_seq_num_gop_ GUARDED_BY(crit_); |
141 | 146 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, | 194 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, |
190 kMaxTemporalLayers> | 195 kMaxTemporalLayers> |
191 missing_frames_for_layer_ GUARDED_BY(crit_); | 196 missing_frames_for_layer_ GUARDED_BY(crit_); |
192 | 197 |
193 // How far frames have been cleared by sequence number. A frame will be | 198 // How far frames have been cleared by sequence number. A frame will be |
194 // cleared if it contains a packet with a sequence number older than | 199 // cleared if it contains a packet with a sequence number older than |
195 // |cleared_to_seq_num_|. | 200 // |cleared_to_seq_num_|. |
196 int cleared_to_seq_num_ GUARDED_BY(crit_); | 201 int cleared_to_seq_num_ GUARDED_BY(crit_); |
197 | 202 |
198 OnCompleteFrameCallback* frame_callback_; | 203 OnCompleteFrameCallback* frame_callback_; |
204 | |
205 // Vp9PidFix variables | |
206 // TODO(philipel): Remove when VP9 PID does not jump mid-stream. | |
207 int vp9_fix_last_timestamp_ = -1; | |
208 int vp9_fix_jump_timestamp_ = -1; | |
209 int vp9_fix_last_picture_id_ = -1; | |
210 int vp9_fix_pid_offset_ = 0; | |
211 int vp9_fix_last_tl0_pic_idx_ = -1; | |
212 int vp9_fix_tl0_pic_idx_offset_ = 0; | |
199 }; | 213 }; |
200 | 214 |
201 } // namespace video_coding | 215 } // namespace video_coding |
202 } // namespace webrtc | 216 } // namespace webrtc |
203 | 217 |
204 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ | 218 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ |
OLD | NEW |