Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: webrtc/modules/video_coding/rtp_frame_reference_finder.h

Issue 2480293002: New jitter buffer experiment. (Closed)
Patch Set: Nit fix. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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/TL0 does not jump mid-stream (should be
134 // around M59).
135 bool Vp9PidTl0Fix(const RtpFrameObject& frame,
136 int16_t* picture_id,
137 int16_t* tl0_pic_idx) EXCLUSIVE_LOCKS_REQUIRED(crit_);
138
139 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be
140 // around M59).
141 bool DetectVp9PicIdJump(int fixed_pid,
142 int fixed_tl0,
143 uint32_t timestamp) const
144 EXCLUSIVE_LOCKS_REQUIRED(crit_);
145
146 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be
147 // around M59).
148 bool DetectVp9Tl0PicIdxJump(int fixed_tl0, uint32_t timestamp) const
149 EXCLUSIVE_LOCKS_REQUIRED(crit_);
132 150
133 // For every group of pictures, hold two sequence numbers. The first being 151 // 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 152 // 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 153 // the second being the sequence number of the last packet of the last
136 // completed frame advanced by any potential continuous packets of padding. 154 // completed frame advanced by any potential continuous packets of padding.
137 std::map<uint16_t, 155 std::map<uint16_t,
138 std::pair<uint16_t, uint16_t>, 156 std::pair<uint16_t, uint16_t>,
139 DescendingSeqNumComp<uint16_t>> 157 DescendingSeqNumComp<uint16_t>>
140 last_seq_num_gop_ GUARDED_BY(crit_); 158 last_seq_num_gop_ GUARDED_BY(crit_);
141 159
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, 207 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>,
190 kMaxTemporalLayers> 208 kMaxTemporalLayers>
191 missing_frames_for_layer_ GUARDED_BY(crit_); 209 missing_frames_for_layer_ GUARDED_BY(crit_);
192 210
193 // How far frames have been cleared by sequence number. A frame will be 211 // 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 212 // cleared if it contains a packet with a sequence number older than
195 // |cleared_to_seq_num_|. 213 // |cleared_to_seq_num_|.
196 int cleared_to_seq_num_ GUARDED_BY(crit_); 214 int cleared_to_seq_num_ GUARDED_BY(crit_);
197 215
198 OnCompleteFrameCallback* frame_callback_; 216 OnCompleteFrameCallback* frame_callback_;
217
218 // Vp9PidFix variables
219 // TODO(philipel): Remove when VP9 PID does not jump mid-stream.
220 int vp9_fix_last_timestamp_ = -1;
221 int vp9_fix_jump_timestamp_ = -1;
222 int vp9_fix_last_picture_id_ = -1;
223 int vp9_fix_pid_offset_ = 0;
224 int vp9_fix_last_tl0_pic_idx_ = -1;
225 int vp9_fix_tl0_pic_idx_offset_ = 0;
199 }; 226 };
200 227
201 } // namespace video_coding 228 } // namespace video_coding
202 } // namespace webrtc 229 } // namespace webrtc
203 230
204 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ 231 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698