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 <algorithm> | |
6 | |
5 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
6 #include "base/bind.h" | 8 #include "base/bind.h" |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/files/memory_mapped_file.h" | 11 #include "base/files/memory_mapped_file.h" |
10 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
11 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
12 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 unsigned int keyframe_period, | 563 unsigned int keyframe_period, |
562 bool force_bitrate, | 564 bool force_bitrate, |
563 bool test_perf, | 565 bool test_perf, |
564 bool mid_stream_bitrate_switch, | 566 bool mid_stream_bitrate_switch, |
565 bool mid_stream_framerate_switch, | 567 bool mid_stream_framerate_switch, |
566 bool run_at_fps); | 568 bool run_at_fps); |
567 ~VEAClient() override; | 569 ~VEAClient() override; |
568 void CreateEncoder(); | 570 void CreateEncoder(); |
569 void DestroyEncoder(); | 571 void DestroyEncoder(); |
570 | 572 |
571 // Return the number of encoded frames per second. | 573 // Returns the number of encoded frames per second. |
Owen Lin
2015/05/04 09:37:12
why Return"s"? Most comments in this file use "Ret
Justin Chuang
2015/05/04 10:25:09
OK. The correct way should be "returns" for first
Justin Chuang
2015/05/06 10:35:32
Done.
| |
572 double frames_per_second(); | 574 double frames_per_second(); |
573 | 575 |
576 // Returns a list of encode latency of the frames at the percentages in | |
Owen Lin
2015/05/04 09:37:12
Why make it public? it is only used in VEAClient.
Justin Chuang
2015/05/04 10:25:09
I put this close to frames_per_second(). Or maybe
Owen Lin
2015/05/05 06:03:13
I see. It sounds we should move frames_per_second(
Justin Chuang
2015/05/06 10:35:32
Done.
| |
577 // |ratios|. The values in |ratios| must be between 0 and 1.0. | |
578 std::vector<base::TimeDelta> encode_latency(const std::vector<float>& ratios); | |
579 | |
574 // VideoDecodeAccelerator::Client implementation. | 580 // VideoDecodeAccelerator::Client implementation. |
575 void RequireBitstreamBuffers(unsigned int input_count, | 581 void RequireBitstreamBuffers(unsigned int input_count, |
576 const gfx::Size& input_coded_size, | 582 const gfx::Size& input_coded_size, |
577 size_t output_buffer_size) override; | 583 size_t output_buffer_size) override; |
578 void BitstreamBufferReady(int32 bitstream_buffer_id, | 584 void BitstreamBufferReady(int32 bitstream_buffer_id, |
579 size_t payload_size, | 585 size_t payload_size, |
580 bool key_frame) override; | 586 bool key_frame) override; |
581 void NotifyError(VideoEncodeAccelerator::Error error) override; | 587 void NotifyError(VideoEncodeAccelerator::Error error) override; |
582 | 588 |
583 private: | 589 private: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
615 // Test codec performance, failing the test if we are currently running | 621 // Test codec performance, failing the test if we are currently running |
616 // the performance test. | 622 // the performance test. |
617 void VerifyPerf(); | 623 void VerifyPerf(); |
618 | 624 |
619 // Write IVF file header to test_stream_->out_filename. | 625 // Write IVF file header to test_stream_->out_filename. |
620 void WriteIvfFileHeader(); | 626 void WriteIvfFileHeader(); |
621 | 627 |
622 // Write an IVF frame header to test_stream_->out_filename. | 628 // Write an IVF frame header to test_stream_->out_filename. |
623 void WriteIvfFrameHeader(int frame_index, size_t frame_size); | 629 void WriteIvfFrameHeader(int frame_index, size_t frame_size); |
624 | 630 |
625 // Prepare and return a frame wrapping the data at |position| bytes in | 631 // Prepare and return a frame wrapping the data at |position| bytes in the |
626 // the input stream, ready to be sent to encoder. | 632 // input stream, ready to be sent to encoder. Returns a pair of video frame |
627 scoped_refptr<media::VideoFrame> PrepareInputFrame(off_t position); | 633 // and the input frame id. |
634 std::pair<scoped_refptr<media::VideoFrame>, int32> PrepareInputFrame( | |
Owen Lin
2015/05/04 09:37:12
We already has the next_input_id_ using around the
Justin Chuang
2015/05/04 10:25:09
But the value is incremented by 1 than the value I
Owen Lin
2015/05/05 06:03:13
I got your point. See my reply below.
| |
635 off_t position); | |
628 | 636 |
629 // Update the parameters according to |mid_stream_bitrate_switch| and | 637 // Update the parameters according to |mid_stream_bitrate_switch| and |
630 // |mid_stream_framerate_switch|. | 638 // |mid_stream_framerate_switch|. |
631 void UpdateTestStreamData(bool mid_stream_bitrate_switch, | 639 void UpdateTestStreamData(bool mid_stream_bitrate_switch, |
632 bool mid_stream_framerate_switch); | 640 bool mid_stream_framerate_switch); |
633 | 641 |
634 // Callback function of the |input_timer_|. | 642 // Callback function of the |input_timer_|. |
635 void OnInputTimer(); | 643 void OnInputTimer(); |
636 | 644 |
637 ClientState state_; | 645 ClientState state_; |
638 scoped_ptr<VideoEncodeAccelerator> encoder_; | 646 scoped_ptr<VideoEncodeAccelerator> encoder_; |
639 | 647 |
640 TestStream* test_stream_; | 648 TestStream* test_stream_; |
641 | 649 |
642 // Used to notify another thread about the state. VEAClient does not own this. | 650 // Used to notify another thread about the state. VEAClient does not own this. |
643 ClientStateNotification<ClientState>* note_; | 651 ClientStateNotification<ClientState>* note_; |
644 | 652 |
645 // Ids assigned to VideoFrames (start at 1 for easy comparison with | 653 // Ids assigned to VideoFrames. |
646 // num_encoded_frames_). | |
647 std::set<int32> inputs_at_client_; | 654 std::set<int32> inputs_at_client_; |
648 int32 next_input_id_; | 655 int32 next_input_id_; |
649 | 656 |
657 typedef std::map<int32, base::TimeTicks> IdToTicks; | |
658 // A map from input frame id to the encode start time of the frame. | |
659 IdToTicks encode_start_time_per_frame_; | |
660 // The encode latencies of all encoded frames. | |
661 std::vector<base::TimeDelta> encode_latencies_; | |
662 | |
650 // Ids for output BitstreamBuffers. | 663 // Ids for output BitstreamBuffers. |
651 typedef std::map<int32, base::SharedMemory*> IdToSHM; | 664 typedef std::map<int32, base::SharedMemory*> IdToSHM; |
652 ScopedVector<base::SharedMemory> output_shms_; | 665 ScopedVector<base::SharedMemory> output_shms_; |
653 IdToSHM output_buffers_at_client_; | 666 IdToSHM output_buffers_at_client_; |
654 int32 next_output_buffer_id_; | 667 int32 next_output_buffer_id_; |
655 | 668 |
656 // Current offset into input stream. | 669 // Current offset into input stream. |
657 off_t pos_in_input_stream_; | 670 off_t pos_in_input_stream_; |
658 gfx::Size input_coded_size_; | 671 gfx::Size input_coded_size_; |
659 // Requested by encoder. | 672 // Requested by encoder. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
908 } | 921 } |
909 if (requested_subsequent_framerate_ == 0) | 922 if (requested_subsequent_framerate_ == 0) |
910 requested_subsequent_framerate_ = 1; | 923 requested_subsequent_framerate_ = 1; |
911 } | 924 } |
912 | 925 |
913 double VEAClient::frames_per_second() { | 926 double VEAClient::frames_per_second() { |
914 base::TimeDelta duration = last_frame_ready_time_ - encode_start_time_; | 927 base::TimeDelta duration = last_frame_ready_time_ - encode_start_time_; |
915 return num_encoded_frames_ / duration.InSecondsF(); | 928 return num_encoded_frames_ / duration.InSecondsF(); |
916 } | 929 } |
917 | 930 |
931 std::vector<base::TimeDelta> VEAClient::encode_latency( | |
932 const std::vector<float>& ratios) { | |
933 std::sort(encode_latencies_.begin(), encode_latencies_.end()); | |
934 size_t size = encode_latencies_.size(); | |
935 std::vector<base::TimeDelta> latencies; | |
936 for (auto ratio : ratios) { | |
937 if (size == 0) { | |
938 latencies.push_back(base::TimeDelta()); | |
939 } else { | |
940 CHECK_GE(ratio, 0.0f); | |
941 CHECK_LE(ratio, 1.0f); | |
942 size_t index = base::checked_cast<size_t>(ratio * (size - 1)); | |
Owen Lin
2015/05/04 09:37:12
Can we either implement the Nearest Rank method or
Justin Chuang
2015/05/04 10:25:09
Yeah... I thought about this. But I think the real
Owen Lin
2015/05/05 06:03:13
First, it won't do extrapolation for outliers (for
Justin Chuang
2015/05/06 10:35:32
Changed to your formula (but s/max/min/). Thanks!
| |
943 latencies.push_back(encode_latencies_[index]); | |
944 } | |
945 } | |
946 return latencies; | |
947 } | |
948 | |
918 void VEAClient::RequireBitstreamBuffers(unsigned int input_count, | 949 void VEAClient::RequireBitstreamBuffers(unsigned int input_count, |
919 const gfx::Size& input_coded_size, | 950 const gfx::Size& input_coded_size, |
920 size_t output_size) { | 951 size_t output_size) { |
921 DCHECK(thread_checker_.CalledOnValidThread()); | 952 DCHECK(thread_checker_.CalledOnValidThread()); |
922 ASSERT_EQ(state_, CS_INITIALIZED); | 953 ASSERT_EQ(state_, CS_INITIALIZED); |
923 SetState(CS_ENCODING); | 954 SetState(CS_ENCODING); |
924 | 955 |
925 CreateAlignedInputStreamFile(input_coded_size, test_stream_); | 956 CreateAlignedInputStreamFile(input_coded_size, test_stream_); |
926 | 957 |
927 num_frames_to_encode_ = test_stream_->num_frames; | 958 num_frames_to_encode_ = test_stream_->num_frames; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1031 } | 1062 } |
1032 | 1063 |
1033 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { | 1064 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { |
1034 std::set<int32>::iterator it = inputs_at_client_.find(input_id); | 1065 std::set<int32>::iterator it = inputs_at_client_.find(input_id); |
1035 ASSERT_NE(it, inputs_at_client_.end()); | 1066 ASSERT_NE(it, inputs_at_client_.end()); |
1036 inputs_at_client_.erase(it); | 1067 inputs_at_client_.erase(it); |
1037 if (!run_at_fps_) | 1068 if (!run_at_fps_) |
1038 FeedEncoderWithOneInput(); | 1069 FeedEncoderWithOneInput(); |
1039 } | 1070 } |
1040 | 1071 |
1041 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) { | 1072 std::pair<scoped_refptr<media::VideoFrame>, int32> VEAClient::PrepareInputFrame( |
1073 off_t position) { | |
1042 CHECK_LE(position + test_stream_->aligned_buffer_size, | 1074 CHECK_LE(position + test_stream_->aligned_buffer_size, |
1043 test_stream_->mapped_aligned_in_file.length()); | 1075 test_stream_->mapped_aligned_in_file.length()); |
1044 | 1076 |
1045 uint8* frame_data_y = const_cast<uint8*>( | 1077 uint8* frame_data_y = const_cast<uint8*>( |
1046 test_stream_->mapped_aligned_in_file.data() + position); | 1078 test_stream_->mapped_aligned_in_file.data() + position); |
1047 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0]; | 1079 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0]; |
1048 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1]; | 1080 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1]; |
1049 | 1081 |
1050 CHECK_GT(current_framerate_, 0U); | 1082 CHECK_GT(current_framerate_, 0U); |
1051 scoped_refptr<media::VideoFrame> frame = | 1083 scoped_refptr<media::VideoFrame> frame = |
(...skipping 10 matching lines...) Expand all Loading... | |
1062 frame_data_v, | 1094 frame_data_v, |
1063 base::TimeDelta().FromMilliseconds( | 1095 base::TimeDelta().FromMilliseconds( |
1064 next_input_id_ * base::Time::kMillisecondsPerSecond / | 1096 next_input_id_ * base::Time::kMillisecondsPerSecond / |
1065 current_framerate_), | 1097 current_framerate_), |
1066 media::BindToCurrentLoop( | 1098 media::BindToCurrentLoop( |
1067 base::Bind(&VEAClient::InputNoLongerNeededCallback, | 1099 base::Bind(&VEAClient::InputNoLongerNeededCallback, |
1068 base::Unretained(this), | 1100 base::Unretained(this), |
1069 next_input_id_))); | 1101 next_input_id_))); |
1070 | 1102 |
1071 CHECK(inputs_at_client_.insert(next_input_id_).second); | 1103 CHECK(inputs_at_client_.insert(next_input_id_).second); |
1072 ++next_input_id_; | |
1073 | 1104 |
1074 return frame; | 1105 return std::make_pair(frame, next_input_id_++); |
1075 } | 1106 } |
1076 | 1107 |
1077 void VEAClient::OnInputTimer() { | 1108 void VEAClient::OnInputTimer() { |
1078 if (!has_encoder() || state_ != CS_ENCODING) | 1109 if (!has_encoder() || state_ != CS_ENCODING) |
1079 input_timer_.reset(); | 1110 input_timer_.reset(); |
1080 else if (inputs_at_client_.size() < | 1111 else if (inputs_at_client_.size() < |
1081 num_required_input_buffers_ + kNumExtraInputFrames) | 1112 num_required_input_buffers_ + kNumExtraInputFrames) |
1082 FeedEncoderWithOneInput(); | 1113 FeedEncoderWithOneInput(); |
1083 else | 1114 else |
1084 DVLOG(1) << "Dropping input frame"; | 1115 DVLOG(1) << "Dropping input frame"; |
1085 } | 1116 } |
1086 | 1117 |
1087 void VEAClient::FeedEncoderWithOneInput() { | 1118 void VEAClient::FeedEncoderWithOneInput() { |
1088 if (!has_encoder() || state_ != CS_ENCODING) | 1119 if (!has_encoder() || state_ != CS_ENCODING) |
1089 return; | 1120 return; |
1090 | 1121 |
1091 size_t bytes_left = | 1122 size_t bytes_left = |
1092 test_stream_->mapped_aligned_in_file.length() - pos_in_input_stream_; | 1123 test_stream_->mapped_aligned_in_file.length() - pos_in_input_stream_; |
1093 if (bytes_left < test_stream_->aligned_buffer_size) { | 1124 if (bytes_left < test_stream_->aligned_buffer_size) { |
1094 DCHECK_EQ(bytes_left, 0UL); | 1125 DCHECK_EQ(bytes_left, 0UL); |
1095 // Rewind if at the end of stream and we are still encoding. | 1126 // Rewind if at the end of stream and we are still encoding. |
1096 // This is to flush the encoder with additional frames from the beginning | 1127 // This is to flush the encoder with additional frames from the beginning |
1097 // of the stream, or if the stream is shorter that the number of frames | 1128 // of the stream, or if the stream is shorter that the number of frames |
1098 // we require for bitrate tests. | 1129 // we require for bitrate tests. |
1099 pos_in_input_stream_ = 0; | 1130 pos_in_input_stream_ = 0; |
1100 } | 1131 } |
1101 | 1132 |
1102 bool force_keyframe = false; | 1133 bool force_keyframe = false; |
1103 if (keyframe_period_ && next_input_id_ % keyframe_period_ == 0) { | 1134 if (keyframe_period_ && next_input_id_ % keyframe_period_ == 0) { |
Owen Lin
2015/05/05 06:03:13
We already used "next_input_id_" in the same funct
| |
1104 force_keyframe = true; | 1135 force_keyframe = true; |
1105 ++num_keyframes_requested_; | 1136 ++num_keyframes_requested_; |
1106 } | 1137 } |
1107 | 1138 |
1108 scoped_refptr<media::VideoFrame> video_frame = | 1139 auto ret = PrepareInputFrame(pos_in_input_stream_); |
Owen Lin
2015/05/04 09:37:12
we can get the input id by:
int32 input_id = next
Justin Chuang
2015/05/04 10:25:09
I don't like this. See above.
Justin Chuang
2015/05/06 10:35:32
Changed the prototype and remove reference to next
| |
1109 PrepareInputFrame(pos_in_input_stream_); | |
1110 pos_in_input_stream_ += test_stream_->aligned_buffer_size; | 1140 pos_in_input_stream_ += test_stream_->aligned_buffer_size; |
1111 | 1141 |
1112 encoder_->Encode(video_frame, force_keyframe); | 1142 CHECK(encode_start_time_per_frame_.insert( |
1143 std::make_pair(ret.second, base::TimeTicks::Now())).second); | |
1144 encoder_->Encode(ret.first, force_keyframe); | |
1113 } | 1145 } |
1114 | 1146 |
1115 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { | 1147 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { |
1116 if (!has_encoder()) | 1148 if (!has_encoder()) |
1117 return; | 1149 return; |
1118 | 1150 |
1119 if (state_ != CS_ENCODING) | 1151 if (state_ != CS_ENCODING) |
1120 return; | 1152 return; |
1121 | 1153 |
1122 base::SharedMemoryHandle dup_handle; | 1154 base::SharedMemoryHandle dup_handle; |
1123 CHECK(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); | 1155 CHECK(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); |
1124 | 1156 |
1125 media::BitstreamBuffer bitstream_buffer( | 1157 media::BitstreamBuffer bitstream_buffer( |
1126 next_output_buffer_id_++, dup_handle, output_buffer_size_); | 1158 next_output_buffer_id_++, dup_handle, output_buffer_size_); |
1127 CHECK(output_buffers_at_client_.insert(std::make_pair(bitstream_buffer.id(), | 1159 CHECK(output_buffers_at_client_.insert(std::make_pair(bitstream_buffer.id(), |
1128 shm)).second); | 1160 shm)).second); |
1129 encoder_->UseOutputBitstreamBuffer(bitstream_buffer); | 1161 encoder_->UseOutputBitstreamBuffer(bitstream_buffer); |
1130 } | 1162 } |
1131 | 1163 |
1132 bool VEAClient::HandleEncodedFrame(bool keyframe) { | 1164 bool VEAClient::HandleEncodedFrame(bool keyframe) { |
1133 // This would be a bug in the test, which should not ignore false | 1165 // This would be a bug in the test, which should not ignore false |
1134 // return value from this method. | 1166 // return value from this method. |
1135 CHECK_LE(num_encoded_frames_, num_frames_to_encode_); | 1167 CHECK_LE(num_encoded_frames_, num_frames_to_encode_); |
1136 | 1168 |
1169 last_frame_ready_time_ = base::TimeTicks::Now(); | |
1170 | |
1171 // Record encode latency of this frame. | |
1172 IdToTicks::iterator it = | |
1173 encode_start_time_per_frame_.find(num_encoded_frames_); | |
1174 CHECK_NE(it, encode_start_time_per_frame_.end()); | |
1175 encode_latencies_.push_back(last_frame_ready_time_ - it->second); | |
1176 encode_start_time_per_frame_.erase(it); | |
1177 | |
1137 ++num_encoded_frames_; | 1178 ++num_encoded_frames_; |
1138 ++num_frames_since_last_check_; | 1179 ++num_frames_since_last_check_; |
1139 | 1180 |
1140 last_frame_ready_time_ = base::TimeTicks::Now(); | |
1141 | |
1142 // Because the keyframe behavior requirements are loose, we give | 1181 // Because the keyframe behavior requirements are loose, we give |
1143 // the encoder more freedom here. It could either deliver a keyframe | 1182 // the encoder more freedom here. It could either deliver a keyframe |
1144 // immediately after we requested it, which could be for a frame number | 1183 // immediately after we requested it, which could be for a frame number |
1145 // before the one we requested it for (if the keyframe request | 1184 // before the one we requested it for (if the keyframe request |
1146 // is asynchronous, i.e. not bound to any concrete frame, and because | 1185 // is asynchronous, i.e. not bound to any concrete frame, and because |
1147 // the pipeline can be deeper than one frame), at that frame, or after. | 1186 // the pipeline can be deeper than one frame), at that frame, or after. |
1148 // So the only constraints we put here is that we get a keyframe not | 1187 // So the only constraints we put here is that we get a keyframe not |
1149 // earlier than we requested one (in time), and not later than | 1188 // earlier than we requested one (in time), and not later than |
1150 // kMaxKeyframeDelay frames after the frame, for which we requested | 1189 // kMaxKeyframeDelay frames after the frame, for which we requested |
1151 // it, comes back encoded. | 1190 // it, comes back encoded. |
(...skipping 30 matching lines...) Expand all Loading... | |
1182 return true; | 1221 return true; |
1183 } | 1222 } |
1184 | 1223 |
1185 void VEAClient::VerifyPerf() { | 1224 void VEAClient::VerifyPerf() { |
1186 double measured_fps = frames_per_second(); | 1225 double measured_fps = frames_per_second(); |
1187 LOG(INFO) << "Measured encoder FPS: " << measured_fps; | 1226 LOG(INFO) << "Measured encoder FPS: " << measured_fps; |
1188 g_env->LogToFile("Measured encoder FPS", | 1227 g_env->LogToFile("Measured encoder FPS", |
1189 base::StringPrintf("%.3f", measured_fps)); | 1228 base::StringPrintf("%.3f", measured_fps)); |
1190 if (test_perf_) | 1229 if (test_perf_) |
1191 EXPECT_GE(measured_fps, kMinPerfFPS); | 1230 EXPECT_GE(measured_fps, kMinPerfFPS); |
1231 | |
1232 std::vector<float> ratios; | |
Owen Lin
2015/05/04 09:37:12
Define them as constant, e.g.
static float kLogg
Justin Chuang
2015/05/04 10:25:09
Will do.
Justin Chuang
2015/05/06 10:35:32
Done.
| |
1233 ratios.push_back(0.50f); | |
1234 ratios.push_back(0.75f); | |
1235 ratios.push_back(0.95f); | |
1236 auto latencies = encode_latency(ratios); | |
1237 for (size_t i = 0; i < ratios.size(); i++) { | |
1238 std::string ratio_str = | |
1239 base::StringPrintf("%d%%", static_cast<int>(ratios[i] * 100)); | |
1240 LOG(INFO) << "Encode latency at " << ratio_str << ": " | |
Owen Lin
2015/05/04 09:37:12
Why using StringPrintf? The following code won't w
Justin Chuang
2015/05/04 10:25:09
This string used in two places.
Owen Lin
2015/05/05 06:03:13
OK, it's fine. But I think you just need the perce
Justin Chuang
2015/05/06 10:35:32
Done. Thanks. Nice tip. +0.5 is good, I added it,
| |
1241 << latencies[i].InMicroseconds() << " us"; | |
1242 g_env->LogToFile( | |
1243 base::StringPrintf("Encode latency at %s", ratio_str.c_str()), | |
1244 base::StringPrintf("%" PRId64 " us", latencies[i].InMicroseconds())); | |
1245 } | |
1192 } | 1246 } |
1193 | 1247 |
1194 void VEAClient::VerifyStreamProperties() { | 1248 void VEAClient::VerifyStreamProperties() { |
1195 CHECK_GT(num_frames_since_last_check_, 0UL); | 1249 CHECK_GT(num_frames_since_last_check_, 0UL); |
1196 CHECK_GT(encoded_stream_size_since_last_check_, 0UL); | 1250 CHECK_GT(encoded_stream_size_since_last_check_, 0UL); |
1197 unsigned int bitrate = encoded_stream_size_since_last_check_ * 8 * | 1251 unsigned int bitrate = encoded_stream_size_since_last_check_ * 8 * |
1198 current_framerate_ / num_frames_since_last_check_; | 1252 current_framerate_ / num_frames_since_last_check_; |
1199 DVLOG(1) << "Current chunk's bitrate: " << bitrate | 1253 DVLOG(1) << "Current chunk's bitrate: " << bitrate |
1200 << " (expected: " << current_requested_bitrate_ | 1254 << " (expected: " << current_requested_bitrate_ |
1201 << " @ " << current_framerate_ << " FPS," | 1255 << " @ " << current_framerate_ << " FPS," |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1441 } | 1495 } |
1442 | 1496 |
1443 content::g_env = | 1497 content::g_env = |
1444 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1498 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
1445 testing::AddGlobalTestEnvironment( | 1499 testing::AddGlobalTestEnvironment( |
1446 new content::VideoEncodeAcceleratorTestEnvironment( | 1500 new content::VideoEncodeAcceleratorTestEnvironment( |
1447 test_stream_data.Pass(), log_path, run_at_fps))); | 1501 test_stream_data.Pass(), log_path, run_at_fps))); |
1448 | 1502 |
1449 return RUN_ALL_TESTS(); | 1503 return RUN_ALL_TESTS(); |
1450 } | 1504 } |
OLD | NEW |