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

Side by Side Diff: chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc

Issue 965403003: Making WebRTC quality tests less dependent on installed tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor win fixes, improved error msg for rbga->i420, frame_analyzer Created 5 years, 9 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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/environment.h" 7 #include "base/environment.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 // Runs the RGBA to I420 converter on the video in |capture_video_filename|, 151 // Runs the RGBA to I420 converter on the video in |capture_video_filename|,
152 // which should contain frames of size |width| x |height|. 152 // which should contain frames of size |width| x |height|.
153 // 153 //
154 // The rgba_to_i420_converter is part of the webrtc_test_tools target which 154 // The rgba_to_i420_converter is part of the webrtc_test_tools target which
155 // should be build prior to running this test. The resulting binary should 155 // should be build prior to running this test. The resulting binary should
156 // live next to Chrome. 156 // live next to Chrome.
157 bool RunARGBtoI420Converter(int width, 157 bool RunARGBtoI420Converter(int width,
158 int height, 158 int height,
159 const base::FilePath& captured_video_filename) { 159 const base::FilePath& captured_video_filename) {
160 base::FilePath path_to_converter = base::MakeAbsoluteFilePath( 160 base::FilePath path_to_converter =
161 GetBrowserDir().Append(kArgbToI420ConverterExecutable)); 161 GetBrowserDir().Append(kArgbToI420ConverterExecutable);
162 162
163 if (!base::PathExists(path_to_converter)) { 163 if (!base::PathExists(path_to_converter)) {
164 LOG(ERROR) << "Missing ARGB->I420 converter: should be in " 164 LOG(ERROR) << "Missing ARGB->I420 converter: should be in "
165 << path_to_converter.value(); 165 << path_to_converter.value()
166 << ". Try building the chromium_builder_webrtc target.";
166 return false; 167 return false;
167 } 168 }
168 169
169 base::CommandLine converter_command(path_to_converter); 170 base::CommandLine converter_command(path_to_converter);
170 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir()); 171 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir());
171 converter_command.AppendSwitchPath("--output_file", 172 converter_command.AppendSwitchPath("--output_file",
172 captured_video_filename); 173 captured_video_filename);
173 converter_command.AppendSwitchASCII("--width", 174 converter_command.AppendSwitchASCII("--width",
174 base::StringPrintf("%d", width)); 175 base::StringPrintf("%d", width));
175 converter_command.AppendSwitchASCII("--height", 176 converter_command.AppendSwitchASCII("--height",
(...skipping 25 matching lines...) Expand all
201 const base::FilePath& reference_video_filename, 202 const base::FilePath& reference_video_filename,
202 const base::FilePath& stats_file) { 203 const base::FilePath& stats_file) {
203 204
204 base::FilePath path_to_analyzer = base::MakeAbsoluteFilePath( 205 base::FilePath path_to_analyzer = base::MakeAbsoluteFilePath(
205 GetBrowserDir().Append(kFrameAnalyzerExecutable)); 206 GetBrowserDir().Append(kFrameAnalyzerExecutable));
206 base::FilePath path_to_compare_script = GetSourceDir().Append( 207 base::FilePath path_to_compare_script = GetSourceDir().Append(
207 FILE_PATH_LITERAL("third_party/webrtc/tools/compare_videos.py")); 208 FILE_PATH_LITERAL("third_party/webrtc/tools/compare_videos.py"));
208 209
209 if (!base::PathExists(path_to_analyzer)) { 210 if (!base::PathExists(path_to_analyzer)) {
210 LOG(ERROR) << "Missing frame analyzer: should be in " 211 LOG(ERROR) << "Missing frame analyzer: should be in "
211 << path_to_analyzer.value(); 212 << path_to_analyzer.value()
213 << ". Try building the chromium_builder_webrtc target.";
212 return false; 214 return false;
213 } 215 }
214 if (!base::PathExists(path_to_compare_script)) { 216 if (!base::PathExists(path_to_compare_script)) {
215 LOG(ERROR) << "Missing video compare script: should be in " 217 LOG(ERROR) << "Missing video compare script: should be in "
216 << path_to_compare_script.value(); 218 << path_to_compare_script.value();
217 return false; 219 return false;
218 } 220 }
219 221
222 base::FilePath path_to_zxing = test::GetToolForPlatform("zxing");
223 if (!base::PathExists(path_to_zxing)) {
224 LOG(ERROR) << "Missing zxing: should be in " << path_to_zxing.value();
225 return false;
226 }
227 base::FilePath path_to_ffmpeg = test::GetToolForPlatform("ffmpeg");
228 if (!base::PathExists(path_to_ffmpeg)) {
229 LOG(ERROR) << "Missing ffmpeg: should be in " << path_to_ffmpeg.value();
230 return false;
231 }
232
220 // Note: don't append switches to this command since it will mess up the 233 // Note: don't append switches to this command since it will mess up the
221 // -u in the python invocation! 234 // -u in the python invocation!
222 base::CommandLine compare_command(base::CommandLine::NO_PROGRAM); 235 base::CommandLine compare_command(base::CommandLine::NO_PROGRAM);
223 EXPECT_TRUE(GetPythonCommand(&compare_command)); 236 EXPECT_TRUE(GetPythonCommand(&compare_command));
224 237
225 compare_command.AppendArgPath(path_to_compare_script); 238 compare_command.AppendArgPath(path_to_compare_script);
226 compare_command.AppendArg(base::StringPrintf("--label=%s", test_label)); 239 compare_command.AppendArg(base::StringPrintf("--label=%s", test_label));
227 compare_command.AppendArg("--ref_video"); 240 compare_command.AppendArg("--ref_video");
228 compare_command.AppendArgPath(reference_video_filename); 241 compare_command.AppendArgPath(reference_video_filename);
229 compare_command.AppendArg("--test_video"); 242 compare_command.AppendArg("--test_video");
230 compare_command.AppendArgPath(captured_video_filename); 243 compare_command.AppendArgPath(captured_video_filename);
231 compare_command.AppendArg("--frame_analyzer"); 244 compare_command.AppendArg("--frame_analyzer");
232 compare_command.AppendArgPath(path_to_analyzer); 245 compare_command.AppendArgPath(path_to_analyzer);
233 compare_command.AppendArg("--yuv_frame_width"); 246 compare_command.AppendArg("--yuv_frame_width");
234 compare_command.AppendArg(base::StringPrintf("%d", width)); 247 compare_command.AppendArg(base::StringPrintf("%d", width));
235 compare_command.AppendArg("--yuv_frame_height"); 248 compare_command.AppendArg("--yuv_frame_height");
236 compare_command.AppendArg(base::StringPrintf("%d", height)); 249 compare_command.AppendArg(base::StringPrintf("%d", height));
250 compare_command.AppendArg("--zxing_path");
251 compare_command.AppendArgPath(path_to_zxing);
252 compare_command.AppendArg("--ffmpeg_path");
253 compare_command.AppendArgPath(path_to_ffmpeg);
237 compare_command.AppendArg("--stats_file"); 254 compare_command.AppendArg("--stats_file");
238 compare_command.AppendArgPath(stats_file); 255 compare_command.AppendArgPath(stats_file);
239 256
240 DVLOG(0) << "Running " << compare_command.GetCommandLineString(); 257 DVLOG(0) << "Running " << compare_command.GetCommandLineString();
241 std::string output; 258 std::string output;
242 bool ok = base::GetAppOutput(compare_command, &output); 259 bool ok = base::GetAppOutput(compare_command, &output);
243 260
244 // Print to stdout to ensure the perf numbers are parsed properly by the 261 // Print to stdout to ensure the perf numbers are parsed properly by the
245 // buildbot step. The tool should print a handful RESULT lines. 262 // buildbot step. The tool should print a handful RESULT lines.
246 printf("Output was:\n\n%s\n", output.c_str()); 263 printf("Output was:\n\n%s\n", output.c_str());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 ASSERT_TRUE(CompareVideosAndPrintResult( 349 ASSERT_TRUE(CompareVideosAndPrintResult(
333 test_config_.test_name, 350 test_config_.test_name,
334 test_config_.width, 351 test_config_.width,
335 test_config_.height, 352 test_config_.height,
336 GetWorkingDir().Append(kCapturedYuvFileName), 353 GetWorkingDir().Append(kCapturedYuvFileName),
337 test::GetReferenceFilesDir() 354 test::GetReferenceFilesDir()
338 .Append(test_config_.reference_video) 355 .Append(test_config_.reference_video)
339 .AddExtension(test::kYuvFileExtension), 356 .AddExtension(test::kYuvFileExtension),
340 GetWorkingDir().Append(kStatsFileName))); 357 GetWorkingDir().Append(kStatsFileName)));
341 } 358 }
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc ('k') | chrome/browser/media/webrtc_browsertest_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698