OLD | NEW |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 H264::FindNaluIndices(buffer.data(), buffer.size()); | 157 H264::FindNaluIndices(buffer.data(), buffer.size()); |
158 EXPECT_EQ(1u, start_offsets.size()); | 158 EXPECT_EQ(1u, start_offsets.size()); |
159 H264::NaluIndex index = start_offsets[0]; | 159 H264::NaluIndex index = start_offsets[0]; |
160 | 160 |
161 H264::NaluType nal_type = | 161 H264::NaluType nal_type = |
162 H264::ParseNaluType(buffer[index.payload_start_offset]); | 162 H264::ParseNaluType(buffer[index.payload_start_offset]); |
163 EXPECT_EQ(H264::kSps, nal_type); | 163 EXPECT_EQ(H264::kSps, nal_type); |
164 index.payload_start_offset += H264::kNaluTypeSize; | 164 index.payload_start_offset += H264::kNaluTypeSize; |
165 index.payload_size -= H264::kNaluTypeSize; | 165 index.payload_size -= H264::kNaluTypeSize; |
166 | 166 |
| 167 std::unique_ptr<rtc::Buffer> rbsp_decoded = |
| 168 H264::ParseRbsp(&buffer[index.payload_start_offset], index.payload_size); |
167 rtc::Optional<SpsParser::SpsState> sps; | 169 rtc::Optional<SpsParser::SpsState> sps; |
168 rtc::Buffer out_buffer; | 170 rtc::Buffer out_buffer; |
169 SpsVuiRewriter::ParseResult result = | 171 SpsVuiRewriter::ParseResult result = SpsVuiRewriter::ParseAndRewriteSps( |
170 SpsVuiRewriter::ParseAndRewriteSps(&buffer[index.payload_start_offset], | 172 rbsp_decoded->data(), rbsp_decoded->size(), &sps, &out_buffer); |
171 index.payload_size, &sps, &out_buffer); | |
172 EXPECT_EQ(expected_parse_result, result); | 173 EXPECT_EQ(expected_parse_result, result); |
173 } | 174 } |
174 | 175 |
175 #define REWRITE_TEST(test_name, mode, expected_parse_result) \ | 176 #define REWRITE_TEST(test_name, mode, expected_parse_result) \ |
176 TEST(SpsVuiRewriterTest, test_name) { TestSps(mode, expected_parse_result); } | 177 TEST(SpsVuiRewriterTest, test_name) { TestSps(mode, expected_parse_result); } |
177 | 178 |
178 REWRITE_TEST(PocCorrect, | 179 REWRITE_TEST(PocCorrect, |
179 kNoRewriteRequired_PocCorrect, | 180 kNoRewriteRequired_PocCorrect, |
180 SpsVuiRewriter::ParseResult::kPocOk); | 181 SpsVuiRewriter::ParseResult::kPocOk); |
181 REWRITE_TEST(VuiAlreadyOptimal, | 182 REWRITE_TEST(VuiAlreadyOptimal, |
182 kNoRewriteRequired_VuiOptimal, | 183 kNoRewriteRequired_VuiOptimal, |
183 SpsVuiRewriter::ParseResult::kVuiOk); | 184 SpsVuiRewriter::ParseResult::kVuiOk); |
184 REWRITE_TEST(RewriteFullVui, | 185 REWRITE_TEST(RewriteFullVui, |
185 kRewriteRequired_NoVui, | 186 kRewriteRequired_NoVui, |
186 SpsVuiRewriter::ParseResult::kVuiRewritten); | 187 SpsVuiRewriter::ParseResult::kVuiRewritten); |
187 REWRITE_TEST(AddBitstreamRestriction, | 188 REWRITE_TEST(AddBitstreamRestriction, |
188 kRewriteRequired_NoBitstreamRestriction, | 189 kRewriteRequired_NoBitstreamRestriction, |
189 SpsVuiRewriter::ParseResult::kVuiRewritten); | 190 SpsVuiRewriter::ParseResult::kVuiRewritten); |
190 REWRITE_TEST(RewriteSuboptimalVui, | 191 REWRITE_TEST(RewriteSuboptimalVui, |
191 kRewriteRequired_VuiSuboptimal, | 192 kRewriteRequired_VuiSuboptimal, |
192 SpsVuiRewriter::ParseResult::kVuiRewritten); | 193 SpsVuiRewriter::ParseResult::kVuiRewritten); |
193 | 194 |
194 } // namespace webrtc | 195 } // namespace webrtc |
OLD | NEW |