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); | |
169 rtc::Optional<SpsParser::SpsState> sps; | 167 rtc::Optional<SpsParser::SpsState> sps; |
170 rtc::Buffer out_buffer; | 168 rtc::Buffer out_buffer; |
171 SpsVuiRewriter::ParseResult result = SpsVuiRewriter::ParseAndRewriteSps( | 169 SpsVuiRewriter::ParseResult result = |
172 rbsp_decoded->data(), rbsp_decoded->size(), &sps, &out_buffer); | 170 SpsVuiRewriter::ParseAndRewriteSps(&buffer[index.payload_start_offset], |
| 171 index.payload_size, &sps, &out_buffer); |
173 EXPECT_EQ(expected_parse_result, result); | 172 EXPECT_EQ(expected_parse_result, result); |
174 } | 173 } |
175 | 174 |
176 #define REWRITE_TEST(test_name, mode, expected_parse_result) \ | 175 #define REWRITE_TEST(test_name, mode, expected_parse_result) \ |
177 TEST(SpsVuiRewriterTest, test_name) { TestSps(mode, expected_parse_result); } | 176 TEST(SpsVuiRewriterTest, test_name) { TestSps(mode, expected_parse_result); } |
178 | 177 |
179 REWRITE_TEST(PocCorrect, | 178 REWRITE_TEST(PocCorrect, |
180 kNoRewriteRequired_PocCorrect, | 179 kNoRewriteRequired_PocCorrect, |
181 SpsVuiRewriter::ParseResult::kPocOk); | 180 SpsVuiRewriter::ParseResult::kPocOk); |
182 REWRITE_TEST(VuiAlreadyOptimal, | 181 REWRITE_TEST(VuiAlreadyOptimal, |
183 kNoRewriteRequired_VuiOptimal, | 182 kNoRewriteRequired_VuiOptimal, |
184 SpsVuiRewriter::ParseResult::kVuiOk); | 183 SpsVuiRewriter::ParseResult::kVuiOk); |
185 REWRITE_TEST(RewriteFullVui, | 184 REWRITE_TEST(RewriteFullVui, |
186 kRewriteRequired_NoVui, | 185 kRewriteRequired_NoVui, |
187 SpsVuiRewriter::ParseResult::kVuiRewritten); | 186 SpsVuiRewriter::ParseResult::kVuiRewritten); |
188 REWRITE_TEST(AddBitstreamRestriction, | 187 REWRITE_TEST(AddBitstreamRestriction, |
189 kRewriteRequired_NoBitstreamRestriction, | 188 kRewriteRequired_NoBitstreamRestriction, |
190 SpsVuiRewriter::ParseResult::kVuiRewritten); | 189 SpsVuiRewriter::ParseResult::kVuiRewritten); |
191 REWRITE_TEST(RewriteSuboptimalVui, | 190 REWRITE_TEST(RewriteSuboptimalVui, |
192 kRewriteRequired_VuiSuboptimal, | 191 kRewriteRequired_VuiSuboptimal, |
193 SpsVuiRewriter::ParseResult::kVuiRewritten); | 192 SpsVuiRewriter::ParseResult::kVuiRewritten); |
194 | 193 |
195 } // namespace webrtc | 194 } // namespace webrtc |
OLD | NEW |