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

Side by Side Diff: webrtc/modules/video_coding/decoding_state.cc

Issue 2534883003: Added sanity check to VCMDecodingState::UsingFlexibleMode to prevent OOB error. (Closed)
Patch Set: Created 4 years 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 | no next file » | 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) 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
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 284 }
285 } 285 }
286 return true; 286 return true;
287 } 287 }
288 288
289 bool VCMDecodingState::UsingPictureId(const VCMFrameBuffer* frame) const { 289 bool VCMDecodingState::UsingPictureId(const VCMFrameBuffer* frame) const {
290 return (frame->PictureId() != kNoPictureId && picture_id_ != kNoPictureId); 290 return (frame->PictureId() != kNoPictureId && picture_id_ != kNoPictureId);
291 } 291 }
292 292
293 bool VCMDecodingState::UsingFlexibleMode(const VCMFrameBuffer* frame) const { 293 bool VCMDecodingState::UsingFlexibleMode(const VCMFrameBuffer* frame) const {
294 return frame->CodecSpecific()->codecType == kVideoCodecVP9 && 294 bool is_flexible_mode =
295 frame->CodecSpecific()->codecSpecific.VP9.flexible_mode; 295 frame->CodecSpecific()->codecType == kVideoCodecVP9 &&
296 frame->CodecSpecific()->codecSpecific.VP9.flexible_mode;
297 if (is_flexible_mode && frame->PictureId() == kNoPictureId) {
298 LOG(LS_WARNING) << "Frame is marked as using flexible mode but no"
299 << "picture id is set.";
300 return false;
301 }
302 return is_flexible_mode;
296 } 303 }
297 304
298 // TODO(philipel): change how check work, this check practially 305 // TODO(philipel): change how check work, this check practially
299 // limits the max p_diff to 64. 306 // limits the max p_diff to 64.
300 bool VCMDecodingState::AheadOfFramesDecodedClearedTo(uint16_t index) const { 307 bool VCMDecodingState::AheadOfFramesDecodedClearedTo(uint16_t index) const {
301 // No way of knowing for sure if we are actually ahead of 308 // No way of knowing for sure if we are actually ahead of
302 // frame_decoded_cleared_to_. We just make the assumption 309 // frame_decoded_cleared_to_. We just make the assumption
303 // that we are not trying to reference back to a very old 310 // that we are not trying to reference back to a very old
304 // index, but instead are referencing a newer index. 311 // index, but instead are referencing a newer index.
305 uint16_t diff = 312 uint16_t diff =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 return false; 357 return false;
351 } 358 }
352 break; 359 break;
353 } 360 }
354 } 361 }
355 } 362 }
356 return true; 363 return true;
357 } 364 }
358 365
359 } // namespace webrtc 366 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698