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

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

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 2 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
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 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 // Requested initial framerate. 958 // Requested initial framerate.
959 unsigned int requested_framerate_; 959 unsigned int requested_framerate_;
960 960
961 // Bitrate to switch to in the middle of the stream. 961 // Bitrate to switch to in the middle of the stream.
962 unsigned int requested_subsequent_bitrate_; 962 unsigned int requested_subsequent_bitrate_;
963 963
964 // Framerate to switch to in the middle of the stream. 964 // Framerate to switch to in the middle of the stream.
965 unsigned int requested_subsequent_framerate_; 965 unsigned int requested_subsequent_framerate_;
966 966
967 // The timer used to feed the encoder with the input frames. 967 // The timer used to feed the encoder with the input frames.
968 scoped_ptr<base::RepeatingTimer<VEAClient>> input_timer_; 968 scoped_ptr<base::RepeatingTimer> input_timer_;
969 }; 969 };
970 970
971 VEAClient::VEAClient(TestStream* test_stream, 971 VEAClient::VEAClient(TestStream* test_stream,
972 ClientStateNotification<ClientState>* note, 972 ClientStateNotification<ClientState>* note,
973 bool save_to_file, 973 bool save_to_file,
974 unsigned int keyframe_period, 974 unsigned int keyframe_period,
975 bool force_bitrate, 975 bool force_bitrate,
976 bool test_perf, 976 bool test_perf,
977 bool mid_stream_bitrate_switch, 977 bool mid_stream_bitrate_switch,
978 bool mid_stream_framerate_switch, 978 bool mid_stream_framerate_switch,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 ASSERT_GT(output_buffer_size_, 0UL); 1202 ASSERT_GT(output_buffer_size_, 0UL);
1203 1203
1204 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { 1204 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) {
1205 base::SharedMemory* shm = new base::SharedMemory(); 1205 base::SharedMemory* shm = new base::SharedMemory();
1206 LOG_ASSERT(shm->CreateAndMapAnonymous(output_buffer_size_)); 1206 LOG_ASSERT(shm->CreateAndMapAnonymous(output_buffer_size_));
1207 output_shms_.push_back(shm); 1207 output_shms_.push_back(shm);
1208 FeedEncoderWithOutput(shm); 1208 FeedEncoderWithOutput(shm);
1209 } 1209 }
1210 1210
1211 if (g_env->run_at_fps()) { 1211 if (g_env->run_at_fps()) {
1212 input_timer_.reset(new base::RepeatingTimer<VEAClient>()); 1212 input_timer_.reset(new base::RepeatingTimer());
1213 input_timer_->Start( 1213 input_timer_->Start(
1214 FROM_HERE, base::TimeDelta::FromSeconds(1) / current_framerate_, 1214 FROM_HERE, base::TimeDelta::FromSeconds(1) / current_framerate_,
1215 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this))); 1215 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this)));
1216 } else { 1216 } else {
1217 while (inputs_at_client_.size() < 1217 while (inputs_at_client_.size() <
1218 num_required_input_buffers_ + kNumExtraInputFrames) 1218 num_required_input_buffers_ + kNumExtraInputFrames)
1219 FeedEncoderWithOneInput(); 1219 FeedEncoderWithOneInput();
1220 } 1220 }
1221 } 1221 }
1222 1222
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 1765
1766 content::g_env = 1766 content::g_env =
1767 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( 1767 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>(
1768 testing::AddGlobalTestEnvironment( 1768 testing::AddGlobalTestEnvironment(
1769 new content::VideoEncodeAcceleratorTestEnvironment( 1769 new content::VideoEncodeAcceleratorTestEnvironment(
1770 test_stream_data.Pass(), log_path, run_at_fps, 1770 test_stream_data.Pass(), log_path, run_at_fps,
1771 needs_encode_latency, verify_all_output))); 1771 needs_encode_latency, verify_all_output)));
1772 1772
1773 return RUN_ALL_TESTS(); 1773 return RUN_ALL_TESTS();
1774 } 1774 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698