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

Side by Side Diff: media/gpu/video_encode_accelerator_unittest.cc

Issue 2296273002: Revert of Use webrtc::VideoFrame timestamp in RTCVideoEncoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 | « content/renderer/media/gpu/rtc_video_encoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 bool seen_sps_; 563 bool seen_sps_;
564 bool seen_pps_; 564 bool seen_pps_;
565 bool seen_idr_; 565 bool seen_idr_;
566 566
567 H264Parser h264_parser_; 567 H264Parser h264_parser_;
568 }; 568 };
569 569
570 void H264Validator::ProcessStreamBuffer(const uint8_t* stream, size_t size) { 570 void H264Validator::ProcessStreamBuffer(const uint8_t* stream, size_t size) {
571 h264_parser_.SetStream(stream, static_cast<off_t>(size)); 571 h264_parser_.SetStream(stream, static_cast<off_t>(size));
572 572
573 // Run |frame_cb_| for only first nalu.
574 bool frame_cb_called = false;
575
576 while (1) { 573 while (1) {
577 H264NALU nalu; 574 H264NALU nalu;
578 H264Parser::Result result; 575 H264Parser::Result result;
579 576
580 result = h264_parser_.AdvanceToNextNALU(&nalu); 577 result = h264_parser_.AdvanceToNextNALU(&nalu);
581 if (result == H264Parser::kEOStream) 578 if (result == H264Parser::kEOStream)
582 break; 579 break;
583 580
584 ASSERT_EQ(H264Parser::kOk, result); 581 ASSERT_EQ(H264Parser::kOk, result);
585 582
586 bool keyframe = false; 583 bool keyframe = false;
587 584
588 switch (nalu.nal_unit_type) { 585 switch (nalu.nal_unit_type) {
589 case H264NALU::kIDRSlice: 586 case H264NALU::kIDRSlice:
590 ASSERT_TRUE(seen_sps_); 587 ASSERT_TRUE(seen_sps_);
591 ASSERT_TRUE(seen_pps_); 588 ASSERT_TRUE(seen_pps_);
592 seen_idr_ = true; 589 seen_idr_ = true;
593 keyframe = true; 590 keyframe = true;
594 // fallthrough 591 // fallthrough
595 case H264NALU::kNonIDRSlice: { 592 case H264NALU::kNonIDRSlice: {
596 // Stream may contain at most one frame.
597 ASSERT_TRUE(seen_idr_); 593 ASSERT_TRUE(seen_idr_);
598 seen_sps_ = seen_pps_ = false; 594 seen_sps_ = seen_pps_ = false;
599 if (!frame_cb_called) { 595 if (!frame_cb_.Run(keyframe))
600 frame_cb_called = true; 596 return;
601 if (!frame_cb_.Run(keyframe))
602 return;
603 }
604 break; 597 break;
605 } 598 }
606 599
607 case H264NALU::kSPS: { 600 case H264NALU::kSPS: {
608 int sps_id; 601 int sps_id;
609 ASSERT_EQ(H264Parser::kOk, h264_parser_.ParseSPS(&sps_id)); 602 ASSERT_EQ(H264Parser::kOk, h264_parser_.ParseSPS(&sps_id));
610 seen_sps_ = true; 603 seen_sps_ = true;
611 break; 604 break;
612 } 605 }
613 606
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 VideoEncodeAcceleratorTest, 1836 VideoEncodeAcceleratorTest,
1844 ::testing::Values(std::make_tuple(3, 1837 ::testing::Values(std::make_tuple(3,
1845 false, 1838 false,
1846 0, 1839 0,
1847 false, 1840 false,
1848 false, 1841 false,
1849 false, 1842 false,
1850 false, 1843 false,
1851 false, 1844 false,
1852 false))); 1845 false)));
1853
1854 #if defined(OS_MACOSX)
1855 INSTANTIATE_TEST_CASE_P(
1856 VerifyTimestamp,
1857 VideoEncodeAcceleratorTest,
1858 ::testing::Values(
1859 std::make_tuple(1, false, 0, false, false, false, false, false, true)));
1860 #endif // defined(OS_MACOSX)
1861
1862 #if defined(OS_WIN) 1846 #if defined(OS_WIN)
1863 INSTANTIATE_TEST_CASE_P( 1847 INSTANTIATE_TEST_CASE_P(
1864 ForceBitrate, 1848 ForceBitrate,
1865 VideoEncodeAcceleratorTest, 1849 VideoEncodeAcceleratorTest,
1866 ::testing::Values( 1850 ::testing::Values(
1867 std::make_tuple(1, false, 0, true, false, false, false, false, false))); 1851 std::make_tuple(1, false, 0, true, false, false, false, false, false)));
1868 #endif // defined(OS_WIN) 1852 #endif // defined(OS_WIN)
1869 1853
1870 #endif // defined(OS_CHROMEOS) 1854 #endif // defined(OS_CHROMEOS)
1871 1855
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 1941
1958 media::g_env = 1942 media::g_env =
1959 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( 1943 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>(
1960 testing::AddGlobalTestEnvironment( 1944 testing::AddGlobalTestEnvironment(
1961 new media::VideoEncodeAcceleratorTestEnvironment( 1945 new media::VideoEncodeAcceleratorTestEnvironment(
1962 std::move(test_stream_data), log_path, run_at_fps, 1946 std::move(test_stream_data), log_path, run_at_fps,
1963 needs_encode_latency, verify_all_output))); 1947 needs_encode_latency, verify_all_output)));
1964 1948
1965 return RUN_ALL_TESTS(); 1949 return RUN_ALL_TESTS();
1966 } 1950 }
OLDNEW
« no previous file with comments | « content/renderer/media/gpu/rtc_video_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698