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

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

Issue 2937243002: Validate references of frames inserted into FrameBuffer2. (Closed)
Patch Set: . Created 3 years, 6 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
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 uint16_t picture_id; 90 uint16_t picture_id;
91 uint8_t spatial_layer; 91 uint8_t spatial_layer;
92 }; 92 };
93 93
94 struct FrameInfo { 94 struct FrameInfo {
95 // The maximum number of frames that can depend on this frame. 95 // The maximum number of frames that can depend on this frame.
96 static constexpr size_t kMaxNumDependentFrames = 8; 96 static constexpr size_t kMaxNumDependentFrames = 8;
97 97
98 // Which other frames that have direct unfulfilled dependencies 98 // Which other frames that have direct unfulfilled dependencies
99 // on this frame. 99 // on this frame.
100 // TODO(philipel): Add simple modify/access functions to prevent adding to
tommi 2017/06/15 15:42:10 nit: adding too
stefan-webrtc 2017/06/15 15:47:09 too
101 // many |dependent_frames|.
100 FrameKey dependent_frames[kMaxNumDependentFrames]; 102 FrameKey dependent_frames[kMaxNumDependentFrames];
101 size_t num_dependent_frames = 0; 103 size_t num_dependent_frames = 0;
102 104
103 // A frame is continiuous if it has all its referenced/indirectly 105 // A frame is continiuous if it has all its referenced/indirectly
104 // referenced frames. 106 // referenced frames.
105 // 107 //
106 // How many unfulfilled frames this frame have until it becomes continuous. 108 // How many unfulfilled frames this frame have until it becomes continuous.
107 size_t num_missing_continuous = 0; 109 size_t num_missing_continuous = 0;
108 110
109 // A frame is decodable if all its referenced frames have been decoded. 111 // A frame is decodable if all its referenced frames have been decoded.
110 // 112 //
111 // How many unfulfilled frames this frame have until it becomes decodable. 113 // How many unfulfilled frames this frame have until it becomes decodable.
112 size_t num_missing_decodable = 0; 114 size_t num_missing_decodable = 0;
113 115
114 // If this frame is continuous or not. 116 // If this frame is continuous or not.
115 bool continuous = false; 117 bool continuous = false;
116 118
117 // The actual FrameObject. 119 // The actual FrameObject.
118 std::unique_ptr<FrameObject> frame; 120 std::unique_ptr<FrameObject> frame;
119 }; 121 };
120 122
121 using FrameMap = std::map<FrameKey, FrameInfo>; 123 using FrameMap = std::map<FrameKey, FrameInfo>;
122 124
125 // Check that the references of |frame| are valid.
126 bool ValidReferences(const FrameObject& frame) const;
127
123 // Updates the minimal and maximal playout delays 128 // Updates the minimal and maximal playout delays
124 // depending on the frame. 129 // depending on the frame.
125 void UpdatePlayoutDelays(const FrameObject& frame) 130 void UpdatePlayoutDelays(const FrameObject& frame)
126 EXCLUSIVE_LOCKS_REQUIRED(crit_); 131 EXCLUSIVE_LOCKS_REQUIRED(crit_);
127 132
128 // Update all directly dependent and indirectly dependent frames and mark 133 // Update all directly dependent and indirectly dependent frames and mark
129 // them as continuous if all their references has been fulfilled. 134 // them as continuous if all their references has been fulfilled.
130 void PropagateContinuity(FrameMap::iterator start) 135 void PropagateContinuity(FrameMap::iterator start)
131 EXCLUSIVE_LOCKS_REQUIRED(crit_); 136 EXCLUSIVE_LOCKS_REQUIRED(crit_);
132 137
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); 176 VCMVideoProtection protection_mode_ GUARDED_BY(crit_);
172 VCMReceiveStatisticsCallback* const stats_callback_; 177 VCMReceiveStatisticsCallback* const stats_callback_;
173 178
174 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); 179 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer);
175 }; 180 };
176 181
177 } // namespace video_coding 182 } // namespace video_coding
178 } // namespace webrtc 183 } // namespace webrtc
179 184
180 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ 185 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/frame_buffer2.cc » ('j') | webrtc/modules/video_coding/frame_buffer2.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698