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

Side by Side Diff: webrtc/examples/androidtests/video_quality_loopback_test.py

Issue 2741743002: IdlingResource for destroy() VideoFileRenderer (Closed)
Patch Set: Removal of counting resource Created 3 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 """ 10 """
(...skipping 18 matching lines...) Expand all
29 29
30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 30 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
31 SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir, 31 SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
32 os.pardir)) 32 os.pardir))
33 33
34 34
35 def _RunCommand(argv, cwd=SRC_DIR, **kwargs): 35 def _RunCommand(argv, cwd=SRC_DIR, **kwargs):
36 logging.info('Running %r', argv) 36 logging.info('Running %r', argv)
37 subprocess.check_call(argv, cwd=cwd, **kwargs) 37 subprocess.check_call(argv, cwd=cwd, **kwargs)
38 38
39 def _Popen(argv, cwd=SRC_DIR):
40 logging.info('Running %r', argv)
41 return subprocess.Popen(argv, cwd=cwd)
39 42
40 def _ParseArgs(): 43 def _ParseArgs():
41 parser = argparse.ArgumentParser(description='Start loopback video analysis.') 44 parser = argparse.ArgumentParser(description='Start loopback video analysis.')
42 parser.add_argument('build_dir_android', 45 parser.add_argument('build_dir_android',
43 help='The path to the build directory for Android.') 46 help='The path to the build directory for Android.')
44 parser.add_argument('--build_dir_x86', 47 parser.add_argument('--build_dir_x86',
45 help='The path to the build directory for building locally.') 48 help='The path to the build directory for building locally.')
46 parser.add_argument('--temp_dir', 49 parser.add_argument('--temp_dir',
47 help='A temporary directory to put the output.') 50 help='A temporary directory to put the output.')
48 51
(...skipping 20 matching lines...) Expand all
69 _RunCommand(['gn', 'gen', build_dir_x86]) 72 _RunCommand(['gn', 'gen', build_dir_x86])
70 _RunCommand(['ninja', '-C', build_dir_x86, 'frame_analyzer']) 73 _RunCommand(['ninja', '-C', build_dir_x86, 'frame_analyzer'])
71 74
72 tools_dir = os.path.join(SRC_DIR, 'tools-webrtc') 75 tools_dir = os.path.join(SRC_DIR, 'tools-webrtc')
73 toolchain_dir = os.path.join(tools_dir, 'video_quality_toolchain') 76 toolchain_dir = os.path.join(tools_dir, 'video_quality_toolchain')
74 77
75 # Download ffmpeg and zxing. 78 # Download ffmpeg and zxing.
76 download_script = os.path.join(tools_dir, 'download_tools.py') 79 download_script = os.path.join(tools_dir, 'download_tools.py')
77 _RunCommand([sys.executable, download_script, toolchain_dir]) 80 _RunCommand([sys.executable, download_script, toolchain_dir])
78 81
79 # Run the Espresso code. 82
80 test_script = os.path.join(build_dir_android, 83 apprtc_process = None
81 'bin', 'run_AppRTCMobileTestStubbedVideoIO') 84 collider_process = None
82 _RunCommand([sys.executable, test_script]) 85 reverseforwarder_process = None
86
87 try:
88 # Start AppRTC Server
89 dev_appserver = os.path.join(SRC_DIR, 'out', 'apprtc', 'google_appengine',
90 'dev_appserver.py')
91 appengine_dir = os.path.join(SRC_DIR, 'out', 'apprtc', 'out', 'app_engine')
92 apprtc_process = _Popen(['python', dev_appserver, appengine_dir,
93 '--port=9999', '--admin_port=9998', '--skip_sdk_update_check',
94 '--clear_datastore=yes'])
95
96 # Start Collider
97 collider_path = os.path.join(SRC_DIR, 'out', 'go-workspace', 'bin',
98 'collidermain')
99 collider_process = _Popen([collider_path, '-tls=false', '-port=8089',
100 '-room-server=http://localhost:9999'])
101
102 # Start adb reverse forwarder
103 reverseforwarder_path = os.path.join(
104 SRC_DIR, 'build', 'android', 'adb_reverse_forwarder.py')
105 reverseforwarder_process = _Popen(
106 [reverseforwarder_path, '9999', '9999', '8089', '8089'])
107
108 # Run the Espresso code.
109 test_script = os.path.join(build_dir_android,
110 'bin', 'run_AppRTCMobileTestStubbedVideoIO')
111 _RunCommand([sys.executable, test_script])
112 finally:
113 if apprtc_process:
114 apprtc_process.terminate()
115 if collider_process:
116 collider_process.terminate()
117 if reverseforwarder_process:
118 reverseforwarder_process.terminate()
83 119
84 # Pull the output video. 120 # Pull the output video.
85 test_video = os.path.join(temp_dir, 'test_video.y4m') 121 test_video = os.path.join(temp_dir, 'test_video.y4m')
86 _RunCommand(['adb', 'pull', '/sdcard/output.y4m', test_video]) 122 _RunCommand(['adb', 'pull', '/sdcard/output.y4m', test_video])
87 123
88 test_video_yuv = os.path.join(temp_dir, 'test_video.yuv') 124 test_video_yuv = os.path.join(temp_dir, 'test_video.yuv')
89 125
90 ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg') 126 ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg')
91 127
92 def convert_video(input_video, output_video): 128 def convert_video(input_video, output_video):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 '--stats_file_ref', stats_file_ref, 160 '--stats_file_ref', stats_file_ref,
125 '--stats_file_test', stats_file_test, '--frame_analyzer', frame_analyzer, 161 '--stats_file_test', stats_file_test, '--frame_analyzer', frame_analyzer,
126 '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path]) 162 '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path])
127 163
128 shutil.rmtree(temp_dir) 164 shutil.rmtree(temp_dir)
129 165
130 166
131 if __name__ == '__main__': 167 if __name__ == '__main__':
132 sys.exit(main()) 168 sys.exit(main())
133 169
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698