Chromium Code Reviews| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | |
| 16 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 17 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
| 17 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
| 18 #include "media/base/bitstream_buffer.h" | 19 #include "media/base/bitstream_buffer.h" |
| 19 #include "media/base/test_data_util.h" | 20 #include "media/base/test_data_util.h" |
| 20 #include "media/filters/h264_parser.h" | 21 #include "media/filters/h264_parser.h" |
| 21 #include "media/video/video_encode_accelerator.h" | 22 #include "media/video/video_encode_accelerator.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 24 |
| 24 #if defined(USE_X11) | 25 #if defined(USE_X11) |
| 25 #include "ui/gfx/x/x11_types.h" | 26 #include "ui/gfx/x/x11_types.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // - |requested_subsequent_bitrate| bitrate to switch to in the middle of the | 89 // - |requested_subsequent_bitrate| bitrate to switch to in the middle of the |
| 89 // stream. | 90 // stream. |
| 90 // - |requested_subsequent_framerate| framerate to switch to in the middle | 91 // - |requested_subsequent_framerate| framerate to switch to in the middle |
| 91 // of the stream. | 92 // of the stream. |
| 92 // Bitrate is only forced for tests that test bitrate. | 93 // Bitrate is only forced for tests that test bitrate. |
| 93 const char* g_default_in_filename = "bear_320x192_40frames.yuv"; | 94 const char* g_default_in_filename = "bear_320x192_40frames.yuv"; |
| 94 const char* g_default_in_parameters = ":320:192:1:out.h264:200000"; | 95 const char* g_default_in_parameters = ":320:192:1:out.h264:200000"; |
| 95 // Environment to store test stream data for all test cases. | 96 // Environment to store test stream data for all test cases. |
| 96 class VideoEncodeAcceleratorTestEnvironment; | 97 class VideoEncodeAcceleratorTestEnvironment; |
| 97 VideoEncodeAcceleratorTestEnvironment* g_env; | 98 VideoEncodeAcceleratorTestEnvironment* g_env; |
| 99 double g_input_fps = 0; | |
|
wuchengli
2014/12/09 05:26:32
Document this and move it to VideoEncodeAccelerato
Owen Lin
2014/12/09 08:29:15
Done.
| |
| 98 | 100 |
| 99 struct TestStream { | 101 struct TestStream { |
| 100 TestStream() | 102 TestStream() |
| 101 : num_frames(0), | 103 : num_frames(0), |
| 102 aligned_buffer_size(0), | 104 aligned_buffer_size(0), |
| 103 requested_bitrate(0), | 105 requested_bitrate(0), |
| 104 requested_framerate(0), | 106 requested_framerate(0), |
| 105 requested_subsequent_bitrate(0), | 107 requested_subsequent_bitrate(0), |
| 106 requested_subsequent_framerate(0) {} | 108 requested_subsequent_framerate(0) {} |
| 107 ~TestStream() {} | 109 ~TestStream() {} |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 // Set current stream parameters to given |bitrate| at |framerate|. | 496 // Set current stream parameters to given |bitrate| at |framerate|. |
| 495 void SetStreamParameters(unsigned int bitrate, unsigned int framerate); | 497 void SetStreamParameters(unsigned int bitrate, unsigned int framerate); |
| 496 | 498 |
| 497 // Called when encoder is done with a VideoFrame. | 499 // Called when encoder is done with a VideoFrame. |
| 498 void InputNoLongerNeededCallback(int32 input_id); | 500 void InputNoLongerNeededCallback(int32 input_id); |
| 499 | 501 |
| 500 // Ensure encoder has at least as many inputs as it asked for | 502 // Ensure encoder has at least as many inputs as it asked for |
| 501 // via RequireBitstreamBuffers(). | 503 // via RequireBitstreamBuffers(). |
| 502 void FeedEncoderWithInputs(); | 504 void FeedEncoderWithInputs(); |
| 503 | 505 |
| 506 void FeedEncoderWithOneInputIfPossible(); | |
|
wuchengli
2014/12/09 05:26:33
Document this. Since FeedEncoderWithInputs doesn't
Owen Lin
2014/12/09 08:29:15
The postfix "IfPossible" is because we may not fee
wuchengli
2014/12/10 02:29:14
Then FeedEncoderWithInputs should be changed to Fe
Owen Lin
2014/12/10 05:59:51
I was consider 0 as an example of multiple.
| |
| 507 | |
| 504 // Provide the encoder with a new output buffer. | 508 // Provide the encoder with a new output buffer. |
| 505 void FeedEncoderWithOutput(base::SharedMemory* shm); | 509 void FeedEncoderWithOutput(base::SharedMemory* shm); |
| 506 | 510 |
| 507 // Called on finding a complete frame (with |keyframe| set to true for | 511 // Called on finding a complete frame (with |keyframe| set to true for |
| 508 // keyframes) in the stream, to perform codec-independent, per-frame checks | 512 // keyframes) in the stream, to perform codec-independent, per-frame checks |
| 509 // and accounting. Returns false once we have collected all frames we needed. | 513 // and accounting. Returns false once we have collected all frames we needed. |
| 510 bool HandleEncodedFrame(bool keyframe); | 514 bool HandleEncodedFrame(bool keyframe); |
| 511 | 515 |
| 512 // Verify that stream bitrate has been close to current_requested_bitrate_, | 516 // Verify that stream bitrate has been close to current_requested_bitrate_, |
| 513 // assuming current_framerate_ since the last time VerifyStreamProperties() | 517 // assuming current_framerate_ since the last time VerifyStreamProperties() |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 unsigned int requested_bitrate_; | 610 unsigned int requested_bitrate_; |
| 607 | 611 |
| 608 // Requested initial framerate. | 612 // Requested initial framerate. |
| 609 unsigned int requested_framerate_; | 613 unsigned int requested_framerate_; |
| 610 | 614 |
| 611 // Bitrate to switch to in the middle of the stream. | 615 // Bitrate to switch to in the middle of the stream. |
| 612 unsigned int requested_subsequent_bitrate_; | 616 unsigned int requested_subsequent_bitrate_; |
| 613 | 617 |
| 614 // Framerate to switch to in the middle of the stream. | 618 // Framerate to switch to in the middle of the stream. |
| 615 unsigned int requested_subsequent_framerate_; | 619 unsigned int requested_subsequent_framerate_; |
| 620 | |
| 621 scoped_ptr<base::RepeatingTimer<VEAClient>> input_timer_; | |
| 622 base::TimeDelta input_duration_; | |
|
wuchengli
2014/12/09 05:26:32
Document these two variables.
Owen Lin
2014/12/09 08:29:15
Done.
| |
| 616 }; | 623 }; |
| 617 | 624 |
| 618 VEAClient::VEAClient(TestStream* test_stream, | 625 VEAClient::VEAClient(TestStream* test_stream, |
| 619 ClientStateNotification<ClientState>* note, | 626 ClientStateNotification<ClientState>* note, |
| 620 bool save_to_file, | 627 bool save_to_file, |
| 621 unsigned int keyframe_period, | 628 unsigned int keyframe_period, |
| 622 bool force_bitrate, | 629 bool force_bitrate, |
| 623 bool test_perf, | 630 bool test_perf, |
| 624 bool mid_stream_bitrate_switch, | 631 bool mid_stream_bitrate_switch, |
| 625 bool mid_stream_framerate_switch) | 632 bool mid_stream_framerate_switch) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 649 requested_subsequent_framerate_(0) { | 656 requested_subsequent_framerate_(0) { |
| 650 if (keyframe_period_) | 657 if (keyframe_period_) |
| 651 CHECK_LT(kMaxKeyframeDelay, keyframe_period_); | 658 CHECK_LT(kMaxKeyframeDelay, keyframe_period_); |
| 652 | 659 |
| 653 validator_ = StreamValidator::Create( | 660 validator_ = StreamValidator::Create( |
| 654 test_stream_->requested_profile, | 661 test_stream_->requested_profile, |
| 655 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this))); | 662 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this))); |
| 656 | 663 |
| 657 CHECK(validator_.get()); | 664 CHECK(validator_.get()); |
| 658 | 665 |
| 666 if (g_input_fps > 0) | |
|
wuchengli
2014/12/09 05:26:33
This should be passed from the constructor.
Owen Lin
2014/12/09 08:29:15
Done.
| |
| 667 input_duration_ = base::TimeDelta::FromSeconds(1) / g_input_fps; | |
| 668 | |
| 659 if (save_to_file_) { | 669 if (save_to_file_) { |
| 660 CHECK(!test_stream_->out_filename.empty()); | 670 CHECK(!test_stream_->out_filename.empty()); |
| 661 base::FilePath out_filename(test_stream_->out_filename); | 671 base::FilePath out_filename(test_stream_->out_filename); |
| 662 // This creates or truncates out_filename. | 672 // This creates or truncates out_filename. |
| 663 // Without it, AppendToFile() will not work. | 673 // Without it, AppendToFile() will not work. |
| 664 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); | 674 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); |
| 665 } | 675 } |
| 666 | 676 |
| 667 // Initialize the parameters of the test streams. | 677 // Initialize the parameters of the test streams. |
| 668 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch); | 678 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 699 | 709 |
| 700 SetStreamParameters(requested_bitrate_, requested_framerate_); | 710 SetStreamParameters(requested_bitrate_, requested_framerate_); |
| 701 SetState(CS_INITIALIZED); | 711 SetState(CS_INITIALIZED); |
| 702 } | 712 } |
| 703 | 713 |
| 704 void VEAClient::DestroyEncoder() { | 714 void VEAClient::DestroyEncoder() { |
| 705 DCHECK(thread_checker_.CalledOnValidThread()); | 715 DCHECK(thread_checker_.CalledOnValidThread()); |
| 706 if (!has_encoder()) | 716 if (!has_encoder()) |
| 707 return; | 717 return; |
| 708 encoder_.reset(); | 718 encoder_.reset(); |
| 719 input_timer_.reset(); | |
| 709 } | 720 } |
| 710 | 721 |
| 711 void VEAClient::UpdateTestStreamData(bool mid_stream_bitrate_switch, | 722 void VEAClient::UpdateTestStreamData(bool mid_stream_bitrate_switch, |
| 712 bool mid_stream_framerate_switch) { | 723 bool mid_stream_framerate_switch) { |
| 713 // Use defaults for bitrate/framerate if they are not provided. | 724 // Use defaults for bitrate/framerate if they are not provided. |
| 714 if (test_stream_->requested_bitrate == 0) | 725 if (test_stream_->requested_bitrate == 0) |
| 715 requested_bitrate_ = kDefaultBitrate; | 726 requested_bitrate_ = kDefaultBitrate; |
| 716 else | 727 else |
| 717 requested_bitrate_ = test_stream_->requested_bitrate; | 728 requested_bitrate_ = test_stream_->requested_bitrate; |
| 718 | 729 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 ASSERT_GT(output_buffer_size_, 0UL); | 796 ASSERT_GT(output_buffer_size_, 0UL); |
| 786 | 797 |
| 787 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { | 798 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { |
| 788 base::SharedMemory* shm = new base::SharedMemory(); | 799 base::SharedMemory* shm = new base::SharedMemory(); |
| 789 CHECK(shm->CreateAndMapAnonymous(output_buffer_size_)); | 800 CHECK(shm->CreateAndMapAnonymous(output_buffer_size_)); |
| 790 output_shms_.push_back(shm); | 801 output_shms_.push_back(shm); |
| 791 FeedEncoderWithOutput(shm); | 802 FeedEncoderWithOutput(shm); |
| 792 } | 803 } |
| 793 | 804 |
| 794 encode_start_time_ = base::TimeTicks::Now(); | 805 encode_start_time_ = base::TimeTicks::Now(); |
| 795 FeedEncoderWithInputs(); | 806 if (input_duration_ == base::TimeDelta()) { |
| 807 FeedEncoderWithInputs(); | |
| 808 } else { | |
| 809 input_timer_.reset(new base::RepeatingTimer<VEAClient>()); | |
| 810 input_timer_->Start(FROM_HERE, input_duration_, this, | |
| 811 &VEAClient::FeedEncoderWithOneInputIfPossible); | |
| 812 } | |
| 796 } | 813 } |
| 797 | 814 |
| 798 void VEAClient::BitstreamBufferReady(int32 bitstream_buffer_id, | 815 void VEAClient::BitstreamBufferReady(int32 bitstream_buffer_id, |
| 799 size_t payload_size, | 816 size_t payload_size, |
| 800 bool key_frame) { | 817 bool key_frame) { |
| 801 DCHECK(thread_checker_.CalledOnValidThread()); | 818 DCHECK(thread_checker_.CalledOnValidThread()); |
| 802 ASSERT_LE(payload_size, output_buffer_size_); | 819 ASSERT_LE(payload_size, output_buffer_size_); |
| 803 | 820 |
| 804 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id); | 821 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id); |
| 805 ASSERT_NE(it, output_buffers_at_client_.end()); | 822 ASSERT_NE(it, output_buffers_at_client_.end()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 encoder_->RequestEncodingParametersChange(current_requested_bitrate_, | 866 encoder_->RequestEncodingParametersChange(current_requested_bitrate_, |
| 850 current_framerate_); | 867 current_framerate_); |
| 851 DVLOG(1) << "Switched parameters to " << current_requested_bitrate_ | 868 DVLOG(1) << "Switched parameters to " << current_requested_bitrate_ |
| 852 << " bps @ " << current_framerate_ << " FPS"; | 869 << " bps @ " << current_framerate_ << " FPS"; |
| 853 } | 870 } |
| 854 | 871 |
| 855 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { | 872 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { |
| 856 std::set<int32>::iterator it = inputs_at_client_.find(input_id); | 873 std::set<int32>::iterator it = inputs_at_client_.find(input_id); |
| 857 ASSERT_NE(it, inputs_at_client_.end()); | 874 ASSERT_NE(it, inputs_at_client_.end()); |
| 858 inputs_at_client_.erase(it); | 875 inputs_at_client_.erase(it); |
| 859 FeedEncoderWithInputs(); | 876 if (input_duration_ == base::TimeDelta()) |
| 877 FeedEncoderWithInputs(); | |
| 860 } | 878 } |
| 861 | 879 |
| 862 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) { | 880 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) { |
| 863 CHECK_LE(position + test_stream_->aligned_buffer_size, | 881 CHECK_LE(position + test_stream_->aligned_buffer_size, |
| 864 test_stream_->mapped_aligned_in_file.length()); | 882 test_stream_->mapped_aligned_in_file.length()); |
| 865 | 883 |
| 866 uint8* frame_data_y = const_cast<uint8*>( | 884 uint8* frame_data_y = const_cast<uint8*>( |
| 867 test_stream_->mapped_aligned_in_file.data() + position); | 885 test_stream_->mapped_aligned_in_file.data() + position); |
| 868 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0]; | 886 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0]; |
| 869 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1]; | 887 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1]; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 888 base::Bind(&VEAClient::InputNoLongerNeededCallback, | 906 base::Bind(&VEAClient::InputNoLongerNeededCallback, |
| 889 base::Unretained(this), | 907 base::Unretained(this), |
| 890 next_input_id_))); | 908 next_input_id_))); |
| 891 | 909 |
| 892 CHECK(inputs_at_client_.insert(next_input_id_).second); | 910 CHECK(inputs_at_client_.insert(next_input_id_).second); |
| 893 ++next_input_id_; | 911 ++next_input_id_; |
| 894 | 912 |
| 895 return frame; | 913 return frame; |
| 896 } | 914 } |
| 897 | 915 |
| 898 void VEAClient::FeedEncoderWithInputs() { | 916 void VEAClient::FeedEncoderWithInputs() { |
|
wuchengli
2014/12/09 05:26:32
FeedEncoderWithInputs should be implemented by cal
Owen Lin
2014/12/09 08:29:15
Done.
| |
| 899 if (!has_encoder()) | 917 if (!has_encoder()) |
| 900 return; | 918 return; |
| 901 | 919 |
| 902 if (state_ != CS_ENCODING) | 920 if (state_ != CS_ENCODING) |
| 903 return; | 921 return; |
| 904 | 922 |
| 905 while (inputs_at_client_.size() < | 923 while (inputs_at_client_.size() < |
| 906 num_required_input_buffers_ + kNumExtraInputFrames) { | 924 num_required_input_buffers_ + kNumExtraInputFrames) { |
| 907 size_t bytes_left = | 925 size_t bytes_left = |
| 908 test_stream_->mapped_aligned_in_file.length() - pos_in_input_stream_; | 926 test_stream_->mapped_aligned_in_file.length() - pos_in_input_stream_; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 923 } | 941 } |
| 924 | 942 |
| 925 scoped_refptr<media::VideoFrame> video_frame = | 943 scoped_refptr<media::VideoFrame> video_frame = |
| 926 PrepareInputFrame(pos_in_input_stream_); | 944 PrepareInputFrame(pos_in_input_stream_); |
| 927 pos_in_input_stream_ += test_stream_->aligned_buffer_size; | 945 pos_in_input_stream_ += test_stream_->aligned_buffer_size; |
| 928 | 946 |
| 929 encoder_->Encode(video_frame, force_keyframe); | 947 encoder_->Encode(video_frame, force_keyframe); |
| 930 } | 948 } |
| 931 } | 949 } |
| 932 | 950 |
| 951 void VEAClient::FeedEncoderWithOneInputIfPossible() { | |
| 952 if (!has_encoder() || state_ != CS_ENCODING) { | |
| 953 // Destroctor will also stop the timer. | |
|
wuchengli
2014/12/09 05:26:33
Destructor
Owen Lin
2014/12/09 08:29:15
Done.
| |
| 954 input_timer_.reset(); | |
| 955 return; | |
| 956 } | |
| 957 | |
| 958 size_t bytes_left = | |
| 959 test_stream_->mapped_aligned_in_file.length() - pos_in_input_stream_; | |
| 960 if (bytes_left < test_stream_->aligned_buffer_size) { | |
| 961 DCHECK_EQ(bytes_left, 0UL); | |
| 962 // Rewind if at the end of stream and we are still encoding. | |
| 963 // This is to flush the encoder with additional frames from the beginning | |
| 964 // of the stream, or if the stream is shorter that the number of frames | |
| 965 // we require for bitrate tests. | |
| 966 pos_in_input_stream_ = 0; | |
| 967 } | |
| 968 | |
| 969 if (inputs_at_client_.size() >= | |
| 970 num_required_input_buffers_ + kNumExtraInputFrames) { | |
| 971 DVLOG(1) << "Drop Input Frame: " + pos_in_input_stream_; | |
| 972 pos_in_input_stream_ += test_stream_->aligned_buffer_size; | |
| 973 return; | |
| 974 } | |
| 975 | |
| 976 bool force_keyframe = false; | |
| 977 if (keyframe_period_ && next_input_id_ % keyframe_period_ == 0) { | |
| 978 keyframe_requested_at_ = next_input_id_; | |
| 979 force_keyframe = true; | |
| 980 } | |
| 981 | |
| 982 scoped_refptr<media::VideoFrame> video_frame = | |
| 983 PrepareInputFrame(pos_in_input_stream_); | |
| 984 pos_in_input_stream_ += test_stream_->aligned_buffer_size; | |
| 985 | |
| 986 encoder_->Encode(video_frame, force_keyframe); | |
| 987 } | |
| 988 | |
| 933 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { | 989 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { |
| 934 if (!has_encoder()) | 990 if (!has_encoder()) |
| 935 return; | 991 return; |
| 936 | 992 |
| 937 if (state_ != CS_ENCODING) | 993 if (state_ != CS_ENCODING) |
| 938 return; | 994 return; |
| 939 | 995 |
| 940 base::SharedMemoryHandle dup_handle; | 996 base::SharedMemoryHandle dup_handle; |
| 941 CHECK(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); | 997 CHECK(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); |
| 942 | 998 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1185 DCHECK(cmd_line); | 1241 DCHECK(cmd_line); |
| 1186 | 1242 |
| 1187 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 1243 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
| 1188 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); | 1244 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); |
| 1189 it != switches.end(); | 1245 it != switches.end(); |
| 1190 ++it) { | 1246 ++it) { |
| 1191 if (it->first == "test_stream_data") { | 1247 if (it->first == "test_stream_data") { |
| 1192 test_stream_data->assign(it->second.c_str()); | 1248 test_stream_data->assign(it->second.c_str()); |
| 1193 continue; | 1249 continue; |
| 1194 } | 1250 } |
| 1251 if (it->first == "input_fps") { | |
| 1252 // On Windows, CommandLine::StringType is wstring. We need to convert | |
| 1253 // it to std::string first | |
| 1254 std::string input(it->second.begin(), it->second.end()); | |
| 1255 CHECK(base::StringToDouble(input, &content::g_input_fps)); | |
| 1256 continue; | |
| 1257 } | |
| 1195 if (it->first == "v" || it->first == "vmodule") | 1258 if (it->first == "v" || it->first == "vmodule") |
| 1196 continue; | 1259 continue; |
| 1197 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1260 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1198 } | 1261 } |
| 1199 | 1262 |
| 1200 content::g_env = | 1263 content::g_env = |
| 1201 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1264 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1202 testing::AddGlobalTestEnvironment( | 1265 testing::AddGlobalTestEnvironment( |
| 1203 new content::VideoEncodeAcceleratorTestEnvironment( | 1266 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1204 test_stream_data.Pass()))); | 1267 test_stream_data.Pass()))); |
| 1205 | 1268 |
| 1206 return RUN_ALL_TESTS(); | 1269 return RUN_ALL_TESTS(); |
| 1207 } | 1270 } |
| OLD | NEW |