| 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/command_line.h" | 5 #include "base/command_line.h" | 
| 6 #include "base/environment.h" | 6 #include "base/environment.h" | 
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" | 
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" | 
| 9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" | 
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 60 | 60 | 
| 61 // The working dir should be in the user's home folder. | 61 // The working dir should be in the user's home folder. | 
| 62 static const base::FilePath::CharType kWorkingDirName[] = | 62 static const base::FilePath::CharType kWorkingDirName[] = | 
| 63     FILE_PATH_LITERAL("webrtc_video_quality"); | 63     FILE_PATH_LITERAL("webrtc_video_quality"); | 
| 64 static const base::FilePath::CharType kCapturedYuvFileName[] = | 64 static const base::FilePath::CharType kCapturedYuvFileName[] = | 
| 65     FILE_PATH_LITERAL("captured_video.yuv"); | 65     FILE_PATH_LITERAL("captured_video.yuv"); | 
| 66 static const base::FilePath::CharType kStatsFileName[] = | 66 static const base::FilePath::CharType kStatsFileName[] = | 
| 67     FILE_PATH_LITERAL("stats.txt"); | 67     FILE_PATH_LITERAL("stats.txt"); | 
| 68 static const char kMainWebrtcTestHtmlPage[] = | 68 static const char kMainWebrtcTestHtmlPage[] = | 
| 69     "/webrtc/webrtc_jsep01_test.html"; | 69     "/webrtc/webrtc_jsep01_test.html"; | 
|  | 70 static const char kCapturingWebrtcHtmlPage[] = | 
|  | 71     "/webrtc/webrtc_video_quality_test.html"; | 
| 70 | 72 | 
| 71 // If you change the port number, don't forget to modify video_extraction.js | 73 // If you change the port number, don't forget to modify video_extraction.js | 
| 72 // too! | 74 // too! | 
| 73 static const char kPyWebSocketPortNumber[] = "12221"; | 75 static const char kPyWebSocketPortNumber[] = "12221"; | 
| 74 | 76 | 
| 75 static const struct VideoQualityTestConfig { | 77 static const struct VideoQualityTestConfig { | 
| 76   const char* test_name; | 78   const char* test_name; | 
| 77   int width; | 79   int width; | 
| 78   int height; | 80   int height; | 
| 79   const char* capture_page; |  | 
| 80   const base::FilePath::CharType* reference_video; | 81   const base::FilePath::CharType* reference_video; | 
| 81   const char* constraints; | 82   const char* constraints; | 
| 82 } kVideoConfigurations[] = { | 83 } kVideoConfigurations[] = { | 
| 83   { "360p", 640, 360, | 84   { "360p", 640, 360, | 
| 84     "/webrtc/webrtc_video_quality_test.html", |  | 
| 85     test::kReferenceFileName360p, | 85     test::kReferenceFileName360p, | 
| 86     WebRtcTestBase::kAudioVideoCallConstraints360p }, | 86     WebRtcTestBase::kAudioVideoCallConstraints360p }, | 
| 87   { "720p", 1280, 720, | 87   { "720p", 1280, 720, | 
| 88     "/webrtc/webrtc_video_quality_test_hd.html", |  | 
| 89     test::kReferenceFileName720p, | 88     test::kReferenceFileName720p, | 
| 90     WebRtcTestBase::kAudioVideoCallConstraints720p }, | 89     WebRtcTestBase::kAudioVideoCallConstraints720p }, | 
| 91 }; | 90 }; | 
| 92 | 91 | 
| 93 // Test the video quality of the WebRTC output. | 92 // Test the video quality of the WebRTC output. | 
| 94 // | 93 // | 
| 95 // Prerequisites: This test case must run on a machine with a chrome playing | 94 // Prerequisites: This test case must run on a machine with a chrome playing | 
| 96 // the video from the reference files located in GetReferenceFilesDir(). | 95 // the video from the reference files located in GetReferenceFilesDir(). | 
| 97 // The file kReferenceY4mFileName.kY4mFileExtension is played using a | 96 // The file kReferenceY4mFileName.kY4mFileExtension is played using a | 
| 98 // FileVideoCaptureDevice and its sibling with kYuvFileExtension is used for | 97 // FileVideoCaptureDevice and its sibling with kYuvFileExtension is used for | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 334   ASSERT_TRUE(HasAllRequiredResources()); | 333   ASSERT_TRUE(HasAllRequiredResources()); | 
| 335   ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 334   ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 
| 336   ASSERT_TRUE(StartPyWebSocketServer()); | 335   ASSERT_TRUE(StartPyWebSocketServer()); | 
| 337 | 336 | 
| 338   content::WebContents* left_tab = | 337   content::WebContents* left_tab = | 
| 339       OpenPageAndGetUserMediaInNewTabWithConstraints( | 338       OpenPageAndGetUserMediaInNewTabWithConstraints( | 
| 340           embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), | 339           embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), | 
| 341           test_config_.constraints); | 340           test_config_.constraints); | 
| 342   content::WebContents* right_tab = | 341   content::WebContents* right_tab = | 
| 343       OpenPageAndGetUserMediaInNewTabWithConstraints( | 342       OpenPageAndGetUserMediaInNewTabWithConstraints( | 
| 344           embedded_test_server()->GetURL(test_config_.capture_page), | 343           embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), | 
| 345           test_config_.constraints); | 344           test_config_.constraints); | 
| 346 | 345 | 
| 347   SetupPeerconnectionWithLocalStream(left_tab); | 346   SetupPeerconnectionWithLocalStream(left_tab); | 
| 348   SetupPeerconnectionWithLocalStream(right_tab); | 347   SetupPeerconnectionWithLocalStream(right_tab); | 
| 349 | 348 | 
| 350   NegotiateCall(left_tab, right_tab); | 349   NegotiateCall(left_tab, right_tab); | 
| 351 | 350 | 
| 352   // Poll slower here to avoid flooding the log with messages: capturing and | 351   // Poll slower here to avoid flooding the log with messages: capturing and | 
| 353   // sending frames take quite a bit of time. | 352   // sending frames take quite a bit of time. | 
| 354   int polling_interval_msec = 1000; | 353   int polling_interval_msec = 1000; | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 377   ASSERT_TRUE(CompareVideosAndPrintResult( | 376   ASSERT_TRUE(CompareVideosAndPrintResult( | 
| 378       test_config_.test_name, | 377       test_config_.test_name, | 
| 379       test_config_.width, | 378       test_config_.width, | 
| 380       test_config_.height, | 379       test_config_.height, | 
| 381       GetWorkingDir().Append(kCapturedYuvFileName), | 380       GetWorkingDir().Append(kCapturedYuvFileName), | 
| 382       test::GetReferenceFilesDir() | 381       test::GetReferenceFilesDir() | 
| 383           .Append(test_config_.reference_video) | 382           .Append(test_config_.reference_video) | 
| 384           .AddExtension(test::kYuvFileExtension), | 383           .AddExtension(test::kYuvFileExtension), | 
| 385       GetWorkingDir().Append(kStatsFileName))); | 384       GetWorkingDir().Append(kStatsFileName))); | 
| 386 } | 385 } | 
| OLD | NEW | 
|---|