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

Side by Side Diff: webrtc/common_video/h264/pps_parser_unittest.cc

Issue 2532973002: Sanity check parsed QP values from H264 bitstream (Closed)
Patch Set: add one last range check 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 | « webrtc/common_video/h264/pps_parser.cc ('k') | 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) 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 rtc::Buffer buffer_; 194 rtc::Buffer buffer_;
195 rtc::Optional<PpsParser::PpsState> parsed_pps_; 195 rtc::Optional<PpsParser::PpsState> parsed_pps_;
196 }; 196 };
197 197
198 TEST_F(PpsParserTest, ZeroPps) { 198 TEST_F(PpsParserTest, ZeroPps) {
199 RunTest(); 199 RunTest();
200 } 200 }
201 201
202 TEST_F(PpsParserTest, MaxPps) { 202 TEST_F(PpsParserTest, MaxPps) {
203 generated_pps_.bottom_field_pic_order_in_frame_present_flag = true; 203 generated_pps_.bottom_field_pic_order_in_frame_present_flag = true;
204 generated_pps_.pic_init_qp_minus26 = std::numeric_limits<int32_t>::max(); 204 generated_pps_.pic_init_qp_minus26 = 25;
205 generated_pps_.redundant_pic_cnt_present_flag = 1; // 1 bit value. 205 generated_pps_.redundant_pic_cnt_present_flag = 1; // 1 bit value.
206 generated_pps_.weighted_bipred_idc = (1 << 2) - 1; // 2 bit value. 206 generated_pps_.weighted_bipred_idc = (1 << 2) - 1; // 2 bit value.
207 generated_pps_.weighted_pred_flag = true; 207 generated_pps_.weighted_pred_flag = true;
208 generated_pps_.entropy_coding_mode_flag = true; 208 generated_pps_.entropy_coding_mode_flag = true;
209 generated_pps_.id = 2; 209 generated_pps_.id = 2;
210 generated_pps_.sps_id = 1; 210 generated_pps_.sps_id = 1;
211 RunTest(); 211 RunTest();
212 212
213 generated_pps_.pic_init_qp_minus26 = std::numeric_limits<int32_t>::min() + 1; 213 generated_pps_.pic_init_qp_minus26 = -25;
214 RunTest(); 214 RunTest();
215 } 215 }
216 216
217 TEST_F(PpsParserTest, PpsIdFromSlice) { 217 TEST_F(PpsParserTest, PpsIdFromSlice) {
218 rtc::Optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice( 218 rtc::Optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
219 kH264BitstreamChunk, sizeof(kH264BitstreamChunk)); 219 kH264BitstreamChunk, sizeof(kH264BitstreamChunk));
220 ASSERT_TRUE(pps_id); 220 ASSERT_TRUE(pps_id);
221 EXPECT_EQ(2u, *pps_id); 221 EXPECT_EQ(2u, *pps_id);
222 } 222 }
223 223
224 } // namespace webrtc 224 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/pps_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698