OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <inttypes.h> | 5 #include <inttypes.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 bool seen_sps_; | 557 bool seen_sps_; |
558 bool seen_pps_; | 558 bool seen_pps_; |
559 bool seen_idr_; | 559 bool seen_idr_; |
560 | 560 |
561 H264Parser h264_parser_; | 561 H264Parser h264_parser_; |
562 }; | 562 }; |
563 | 563 |
564 void H264Validator::ProcessStreamBuffer(const uint8_t* stream, size_t size) { | 564 void H264Validator::ProcessStreamBuffer(const uint8_t* stream, size_t size) { |
565 h264_parser_.SetStream(stream, static_cast<off_t>(size)); | 565 h264_parser_.SetStream(stream, static_cast<off_t>(size)); |
566 | 566 |
567 // Run |frame_cb_| for only first nalu. | |
568 bool seen_nonidr = false; | |
569 | |
567 while (1) { | 570 while (1) { |
568 H264NALU nalu; | 571 H264NALU nalu; |
569 H264Parser::Result result; | 572 H264Parser::Result result; |
570 | 573 |
571 result = h264_parser_.AdvanceToNextNALU(&nalu); | 574 result = h264_parser_.AdvanceToNextNALU(&nalu); |
572 if (result == H264Parser::kEOStream) | 575 if (result == H264Parser::kEOStream) |
573 break; | 576 break; |
574 | 577 |
575 ASSERT_EQ(H264Parser::kOk, result); | 578 ASSERT_EQ(H264Parser::kOk, result); |
576 | 579 |
577 bool keyframe = false; | 580 bool keyframe = false; |
578 | 581 |
579 switch (nalu.nal_unit_type) { | 582 switch (nalu.nal_unit_type) { |
580 case H264NALU::kIDRSlice: | 583 case H264NALU::kIDRSlice: |
581 ASSERT_TRUE(seen_sps_); | 584 ASSERT_TRUE(seen_sps_); |
582 ASSERT_TRUE(seen_pps_); | 585 ASSERT_TRUE(seen_pps_); |
583 seen_idr_ = true; | 586 seen_idr_ = true; |
584 keyframe = true; | 587 keyframe = true; |
585 // fallthrough | 588 // fallthrough |
586 case H264NALU::kNonIDRSlice: { | 589 case H264NALU::kNonIDRSlice: { |
587 ASSERT_TRUE(seen_idr_); | 590 ASSERT_TRUE(seen_idr_); |
wuchengli
2016/08/12 15:12:25
You accidentally reverted the code?
if (!seen_noni
emircan
2016/08/24 21:29:17
Done.
| |
588 if (!frame_cb_.Run(keyframe)) | 591 if (!frame_cb_.Run(keyframe)) |
589 return; | 592 return; |
590 break; | 593 break; |
591 } | 594 } |
592 | 595 |
593 case H264NALU::kSPS: { | 596 case H264NALU::kSPS: { |
594 int sps_id; | 597 int sps_id; |
595 ASSERT_EQ(H264Parser::kOk, h264_parser_.ParseSPS(&sps_id)); | 598 ASSERT_EQ(H264Parser::kOk, h264_parser_.ParseSPS(&sps_id)); |
596 seen_sps_ = true; | 599 seen_sps_ = true; |
597 break; | 600 break; |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1829 VideoEncodeAcceleratorTest, | 1832 VideoEncodeAcceleratorTest, |
1830 ::testing::Values(std::make_tuple(3, | 1833 ::testing::Values(std::make_tuple(3, |
1831 false, | 1834 false, |
1832 0, | 1835 0, |
1833 false, | 1836 false, |
1834 false, | 1837 false, |
1835 false, | 1838 false, |
1836 false, | 1839 false, |
1837 false, | 1840 false, |
1838 false))); | 1841 false))); |
1842 | |
1843 #if defined(OS_MACOSX) | |
1844 INSTANTIATE_TEST_CASE_P( | |
1845 VerifyTimestamp, | |
1846 VideoEncodeAcceleratorTest, | |
1847 ::testing::Values( | |
1848 std::make_tuple(1, false, 0, false, false, false, false, false, true))); | |
1849 #endif // defined(OS_MACOSX) | |
1850 | |
1839 #if defined(OS_WIN) | 1851 #if defined(OS_WIN) |
1840 INSTANTIATE_TEST_CASE_P( | 1852 INSTANTIATE_TEST_CASE_P( |
1841 ForceBitrate, | 1853 ForceBitrate, |
1842 VideoEncodeAcceleratorTest, | 1854 VideoEncodeAcceleratorTest, |
1843 ::testing::Values( | 1855 ::testing::Values( |
1844 std::make_tuple(1, false, 0, true, false, false, false, false, false))); | 1856 std::make_tuple(1, false, 0, true, false, false, false, false, false))); |
1845 #endif // defined(OS_WIN) | 1857 #endif // defined(OS_WIN) |
1846 | 1858 |
1847 #endif // defined(OS_CHROMEOS) | 1859 #endif // defined(OS_CHROMEOS) |
1848 | 1860 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1934 | 1946 |
1935 media::g_env = | 1947 media::g_env = |
1936 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( | 1948 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( |
1937 testing::AddGlobalTestEnvironment( | 1949 testing::AddGlobalTestEnvironment( |
1938 new media::VideoEncodeAcceleratorTestEnvironment( | 1950 new media::VideoEncodeAcceleratorTestEnvironment( |
1939 std::move(test_stream_data), log_path, run_at_fps, | 1951 std::move(test_stream_data), log_path, run_at_fps, |
1940 needs_encode_latency, verify_all_output))); | 1952 needs_encode_latency, verify_all_output))); |
1941 | 1953 |
1942 return RUN_ALL_TESTS(); | 1954 return RUN_ALL_TESTS(); |
1943 } | 1955 } |
OLD | NEW |