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

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

Issue 2127073002: Bugfix for Vp9 GOF and missing frames. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Better unittest describing the bug fixed. Created 4 years, 5 months 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/rtp_frame_reference_finder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 37
38 private: 38 private:
39 static const uint16_t kPicIdLength = 1 << 7; 39 static const uint16_t kPicIdLength = 1 << 7;
40 static const uint8_t kMaxTemporalLayers = 5; 40 static const uint8_t kMaxTemporalLayers = 5;
41 static const int kMaxLayerInfo = 10; 41 static const int kMaxLayerInfo = 10;
42 static const int kMaxStashedFrames = 10; 42 static const int kMaxStashedFrames = 10;
43 static const int kMaxNotYetReceivedFrames = 20; 43 static const int kMaxNotYetReceivedFrames = 20;
44 static const int kMaxGofSaved = 15; 44 static const int kMaxGofSaved = 15;
45 static const int kMaxPaddingAge = 100; 45 static const int kMaxPaddingAge = 100;
46 46
47
48 struct GofInfo {
49 GofInfo(GofInfoVP9* gof, uint16_t last_picture_id)
50 : gof(gof), last_picture_id(last_picture_id) {}
51 GofInfoVP9* gof;
52 uint16_t last_picture_id;
53 };
54
47 rtc::CriticalSection crit_; 55 rtc::CriticalSection crit_;
48 56
49 // Find the relevant group of pictures and update its "last-picture-id-with 57 // Find the relevant group of pictures and update its "last-picture-id-with
50 // padding" sequence number. 58 // padding" sequence number.
51 void UpdateLastPictureIdWithPadding(uint16_t seq_num) 59 void UpdateLastPictureIdWithPadding(uint16_t seq_num)
52 EXCLUSIVE_LOCKS_REQUIRED(crit_); 60 EXCLUSIVE_LOCKS_REQUIRED(crit_);
53 61
54 // Retry finding references for all frames that previously didn't have 62 // Retry finding references for all frames that previously didn't have
55 // all information needed. 63 // all information needed.
56 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_); 64 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_);
(...skipping 18 matching lines...) Expand all
75 void ManageFrameVp9(std::unique_ptr<RtpFrameObject> frame) 83 void ManageFrameVp9(std::unique_ptr<RtpFrameObject> frame)
76 EXCLUSIVE_LOCKS_REQUIRED(crit_); 84 EXCLUSIVE_LOCKS_REQUIRED(crit_);
77 85
78 // Unwrap the picture id and the frame references and then call the 86 // Unwrap the picture id and the frame references and then call the
79 // |frame_callback| callback with the completed frame. 87 // |frame_callback| callback with the completed frame.
80 void CompletedFrameVp9(std::unique_ptr<RtpFrameObject> frame) 88 void CompletedFrameVp9(std::unique_ptr<RtpFrameObject> frame)
81 EXCLUSIVE_LOCKS_REQUIRED(crit_); 89 EXCLUSIVE_LOCKS_REQUIRED(crit_);
82 90
83 // Check if we are missing a frame necessary to determine the references 91 // Check if we are missing a frame necessary to determine the references
84 // for this frame. 92 // for this frame.
85 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfoVP9& gof) 93 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info)
86 EXCLUSIVE_LOCKS_REQUIRED(crit_); 94 EXCLUSIVE_LOCKS_REQUIRED(crit_);
87 95
88 // Updates which frames that have been received. If there is a gap, 96 // Updates which frames that have been received. If there is a gap,
89 // missing frames will be added to |missing_frames_for_layer_| or 97 // missing frames will be added to |missing_frames_for_layer_| or
90 // if this is an already missing frame then it will be removed. 98 // if this is an already missing frame then it will be removed.
91 void FrameReceivedVp9(uint16_t picture_id, const GofInfoVP9& gof) 99 void FrameReceivedVp9(uint16_t picture_id, GofInfo* info)
92 EXCLUSIVE_LOCKS_REQUIRED(crit_); 100 EXCLUSIVE_LOCKS_REQUIRED(crit_);
93 101
94 // Check if there is a frame with the up-switch flag set in the interval 102 // Check if there is a frame with the up-switch flag set in the interval
95 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. 103 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|.
96 bool UpSwitchInIntervalVp9(uint16_t picture_id, 104 bool UpSwitchInIntervalVp9(uint16_t picture_id,
97 uint8_t temporal_idx, 105 uint8_t temporal_idx,
98 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); 106 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_);
99 107
100 // All picture ids are unwrapped to 16 bits. 108 // All picture ids are unwrapped to 16 bits.
101 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); 109 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 layer_info_ GUARDED_BY(crit_); 148 layer_info_ GUARDED_BY(crit_);
141 149
142 // Where the current scalability structure is in the 150 // Where the current scalability structure is in the
143 // |scalability_structures_| array. 151 // |scalability_structures_| array.
144 uint8_t current_ss_idx_; 152 uint8_t current_ss_idx_;
145 153
146 // Holds received scalability structures. 154 // Holds received scalability structures.
147 std::array<GofInfoVP9, kMaxGofSaved> scalability_structures_ 155 std::array<GofInfoVP9, kMaxGofSaved> scalability_structures_
148 GUARDED_BY(crit_); 156 GUARDED_BY(crit_);
149 157
150 // Holds the picture id and the Gof information for a given TL0 picture index. 158 // Holds the the Gof information for a given TL0 picture index.
151 std::map<uint8_t, 159 std::map<uint8_t, GofInfo, DescendingSeqNumComp<uint8_t>> gof_info_
152 std::pair<uint16_t, GofInfoVP9*>, 160 GUARDED_BY(crit_);
153 DescendingSeqNumComp<uint8_t>>
154 gof_info_ GUARDED_BY(crit_);
155 161
156 // Keep track of which picture id and which temporal layer that had the 162 // Keep track of which picture id and which temporal layer that had the
157 // up switch flag set. 163 // up switch flag set.
158 std::map<uint16_t, uint8_t> up_switch_ GUARDED_BY(crit_); 164 std::map<uint16_t, uint8_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>
165 up_switch_ GUARDED_BY(crit_);
159 166
160 // For every temporal layer, keep a set of which frames that are missing. 167 // For every temporal layer, keep a set of which frames that are missing.
161 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, 168 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>,
162 kMaxTemporalLayers> 169 kMaxTemporalLayers>
163 missing_frames_for_layer_ GUARDED_BY(crit_); 170 missing_frames_for_layer_ GUARDED_BY(crit_);
164 171
165 OnCompleteFrameCallback* frame_callback_; 172 OnCompleteFrameCallback* frame_callback_;
166 }; 173 };
167 174
168 } // namespace video_coding 175 } // namespace video_coding
169 } // namespace webrtc 176 } // namespace webrtc
170 177
171 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ 178 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/rtp_frame_reference_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698