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

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

Issue 2265023002: Revert of Add pps id and sps id parsing to the h.264 depacketizer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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 | « webrtc/common_video/h264/sps_parser.h ('k') | webrtc/common_video/h264/sps_parser_unittest.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
11 #include "webrtc/common_video/h264/sps_parser.h" 11 #include "webrtc/common_video/h264/sps_parser.h"
12 12
13 #include <memory>
14
15 #include "webrtc/common_video/h264/h264_common.h" 13 #include "webrtc/common_video/h264/h264_common.h"
16 #include "webrtc/base/bitbuffer.h" 14 #include "webrtc/base/bitbuffer.h"
17 #include "webrtc/base/bytebuffer.h" 15 #include "webrtc/base/bytebuffer.h"
18 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
19 17
20 typedef rtc::Optional<webrtc::SpsParser::SpsState> OptionalSps; 18 typedef rtc::Optional<webrtc::SpsParser::SpsState> OptionalSps;
21 19
22 #define RETURN_EMPTY_ON_FAIL(x) \ 20 #define RETURN_EMPTY_ON_FAIL(x) \
23 if (!(x)) { \ 21 if (!(x)) { \
24 return OptionalSps(); \ 22 return OptionalSps(); \
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // profile_idc: u(8). We need it to determine if we need to read/skip chroma 61 // profile_idc: u(8). We need it to determine if we need to read/skip chroma
64 // formats. 62 // formats.
65 uint8_t profile_idc; 63 uint8_t profile_idc;
66 RETURN_EMPTY_ON_FAIL(buffer->ReadUInt8(&profile_idc)); 64 RETURN_EMPTY_ON_FAIL(buffer->ReadUInt8(&profile_idc));
67 // constraint_set0_flag through constraint_set5_flag + reserved_zero_2bits 65 // constraint_set0_flag through constraint_set5_flag + reserved_zero_2bits
68 // 1 bit each for the flags + 2 bits = 8 bits = 1 byte. 66 // 1 bit each for the flags + 2 bits = 8 bits = 1 byte.
69 RETURN_EMPTY_ON_FAIL(buffer->ConsumeBytes(1)); 67 RETURN_EMPTY_ON_FAIL(buffer->ConsumeBytes(1));
70 // level_idc: u(8) 68 // level_idc: u(8)
71 RETURN_EMPTY_ON_FAIL(buffer->ConsumeBytes(1)); 69 RETURN_EMPTY_ON_FAIL(buffer->ConsumeBytes(1));
72 // seq_parameter_set_id: ue(v) 70 // seq_parameter_set_id: ue(v)
73 RETURN_EMPTY_ON_FAIL(buffer->ReadExponentialGolomb(&sps.id)); 71 RETURN_EMPTY_ON_FAIL(buffer->ReadExponentialGolomb(&golomb_ignored));
74 sps.separate_colour_plane_flag = 0; 72 sps.separate_colour_plane_flag = 0;
75 // See if profile_idc has chroma format information. 73 // See if profile_idc has chroma format information.
76 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || 74 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 ||
77 profile_idc == 244 || profile_idc == 44 || profile_idc == 83 || 75 profile_idc == 244 || profile_idc == 44 || profile_idc == 83 ||
78 profile_idc == 86 || profile_idc == 118 || profile_idc == 128 || 76 profile_idc == 86 || profile_idc == 118 || profile_idc == 128 ||
79 profile_idc == 138 || profile_idc == 139 || profile_idc == 134) { 77 profile_idc == 138 || profile_idc == 139 || profile_idc == 134) {
80 // chroma_format_idc: ue(v) 78 // chroma_format_idc: ue(v)
81 RETURN_EMPTY_ON_FAIL(buffer->ReadExponentialGolomb(&chroma_format_idc)); 79 RETURN_EMPTY_ON_FAIL(buffer->ReadExponentialGolomb(&chroma_format_idc));
82 if (chroma_format_idc == 3) { 80 if (chroma_format_idc == 3) {
83 // separate_colour_plane_flag: u(1) 81 // separate_colour_plane_flag: u(1)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 210 }
213 } 211 }
214 // Subtract the crop for each dimension. 212 // Subtract the crop for each dimension.
215 sps.width -= (frame_crop_left_offset + frame_crop_right_offset); 213 sps.width -= (frame_crop_left_offset + frame_crop_right_offset);
216 sps.height -= (frame_crop_top_offset + frame_crop_bottom_offset); 214 sps.height -= (frame_crop_top_offset + frame_crop_bottom_offset);
217 215
218 return OptionalSps(sps); 216 return OptionalSps(sps);
219 } 217 }
220 218
221 } // namespace webrtc 219 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/sps_parser.h ('k') | webrtc/common_video/h264/sps_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698