Chromium Code Reviews| Index: webrtc/common_video/h264/pps_parser.cc |
| diff --git a/webrtc/common_video/h264/pps_parser.cc b/webrtc/common_video/h264/pps_parser.cc |
| index 01a6c76d911ed4670016cf439ae1d8dd01cae52f..4dc095159c1ecaa5b043bc8f2ce187c9d3eab182 100644 |
| --- a/webrtc/common_video/h264/pps_parser.cc |
| +++ b/webrtc/common_video/h264/pps_parser.cc |
| @@ -28,6 +28,32 @@ namespace webrtc { |
| // You can find it on this page: |
| // http://www.itu.int/rec/T-REC-H.264 |
| +bool PpsParser::ParsePpsIds(const uint8_t* data, |
|
danilchap
2016/09/07 10:38:51
Function declaration order should match function d
|
| + size_t length, |
| + uint32_t* pps_id, |
| + uint32_t* sps_id) { |
| + RTC_DCHECK(pps_id); |
| + RTC_DCHECK(sps_id); |
| + // First, parse out rbsp, which is basically the source buffer minus emulation |
| + // bytes (the last byte of a 0x00 0x00 0x03 sequence). RBSP is defined in |
| + // section 7.3.1 of the H.264 standard. |
| + std::unique_ptr<rtc::Buffer> unpacked_buffer = H264::ParseRbsp(data, length); |
| + rtc::BitBuffer bit_buffer(unpacked_buffer->data(), unpacked_buffer->size()); |
| + return ParsePpsIdsInternal(&bit_buffer, pps_id, sps_id); |
| +} |
| + |
| +bool PpsParser::ParsePpsIdsInternal(rtc::BitBuffer* bit_buffer, |
|
danilchap
2016/09/07 10:38:51
and this one after ParseInternal
|
| + uint32_t* pps_id, |
| + uint32_t* sps_id) { |
| + // pic_parameter_set_id: ue(v) |
| + if (!bit_buffer->ReadExponentialGolomb(pps_id)) |
| + return false; |
| + // seq_parameter_set_id: ue(v) |
| + if (!bit_buffer->ReadExponentialGolomb(sps_id)) |
| + return false; |
| + return true; |
| +} |
| + |
| rtc::Optional<PpsParser::PpsState> PpsParser::ParsePps(const uint8_t* data, |
| size_t length) { |
| // First, parse out rbsp, which is basically the source buffer minus emulation |
| @@ -61,12 +87,10 @@ rtc::Optional<PpsParser::PpsState> PpsParser::ParseInternal( |
| rtc::BitBuffer* bit_buffer) { |
| PpsState pps; |
| + RETURN_EMPTY_ON_FAIL(ParsePpsIdsInternal(bit_buffer, &pps.id, &pps.sps_id)); |
| + |
| uint32_t bits_tmp; |
| uint32_t golomb_ignored; |
| - // pic_parameter_set_id: ue(v) |
| - RETURN_EMPTY_ON_FAIL(bit_buffer->ReadExponentialGolomb(&pps.id)); |
| - // seq_parameter_set_id: ue(v) |
| - RETURN_EMPTY_ON_FAIL(bit_buffer->ReadExponentialGolomb(&pps.sps_id)); |
| // entropy_coding_mode_flag: u(1) |
| uint32_t entropy_coding_mode_flag; |
| RETURN_EMPTY_ON_FAIL(bit_buffer->ReadBits(&entropy_coding_mode_flag, 1)); |