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

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

Issue 2741743002: IdlingResource for destroy() VideoFileRenderer (Closed)
Patch Set: Using local Collider and AppRTC Server 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
82 # Start AppRTC Server
83 dev_appserver = os.path.join(SRC_DIR, 'out', 'apprtc', 'google_appengine',
kjellander_webrtc 2017/03/17 12:02:16 Add try+finally around the processes being launche
mandermo 2017/03/17 13:39:42 Fixed with try+finally. Leave SIGINT for later.
84 'dev_appserver.py')
85 appengine_dir = os.path.join(SRC_DIR, 'out', 'apprtc', 'out', 'app_engine')
86 apprtc_process = _Popen(['python', dev_appserver, appengine_dir,
87 '--port=9999', '--admin_port=9998', '--skip_sdk_update_check',
88 '--clear_datastore=yes'])
89
90 # Start Collider
91 collider_path = os.path.join(SRC_DIR, 'out', 'go-workspace', 'bin',
92 'collidermain')
93 collider_process = _Popen([collider_path, '-tls=false', '-port=8089',
94 '-room-server=http://localhost:9999'])
95
96 # Start adb reverse forwarder
97 reverseforwarder_path = os.path.join(
98 SRC_DIR, 'build', 'android', 'adb_reverse_forwarder.py')
99 reverseforwarder_process = _Popen(
100 [reverseforwarder_path, '9999', '9999', '8089', '8089'])
101
79 # Run the Espresso code. 102 # Run the Espresso code.
80 test_script = os.path.join(build_dir_android, 103 test_script = os.path.join(build_dir_android,
81 'bin', 'run_AppRTCMobileTestStubbedVideoIO') 104 'bin', 'run_AppRTCMobileTestStubbedVideoIO')
82 _RunCommand([sys.executable, test_script]) 105 _RunCommand([sys.executable, test_script])
83 106
107 apprtc_process.terminate()
108 collider_process.terminate()
109 reverseforwarder_process.terminate()
110
84 # Pull the output video. 111 # Pull the output video.
85 test_video = os.path.join(temp_dir, 'test_video.y4m') 112 test_video = os.path.join(temp_dir, 'test_video.y4m')
86 _RunCommand(['adb', 'pull', '/sdcard/output.y4m', test_video]) 113 _RunCommand(['adb', 'pull', '/sdcard/output.y4m', test_video])
87 114
88 test_video_yuv = os.path.join(temp_dir, 'test_video.yuv') 115 test_video_yuv = os.path.join(temp_dir, 'test_video.yuv')
89 116
90 ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg') 117 ffmpeg_path = os.path.join(toolchain_dir, 'linux', 'ffmpeg')
91 118
92 def convert_video(input_video, output_video): 119 def convert_video(input_video, output_video):
93 _RunCommand([ffmpeg_path, '-y', '-i', input_video, output_video]) 120 _RunCommand([ffmpeg_path, '-y', '-i', input_video, output_video])
(...skipping 30 matching lines...) Expand all
124 '--stats_file_ref', stats_file_ref, 151 '--stats_file_ref', stats_file_ref,
125 '--stats_file_test', stats_file_test, '--frame_analyzer', frame_analyzer, 152 '--stats_file_test', stats_file_test, '--frame_analyzer', frame_analyzer,
126 '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path]) 153 '--ffmpeg_path', ffmpeg_path, '--zxing_path', zxing_path])
127 154
128 shutil.rmtree(temp_dir) 155 shutil.rmtree(temp_dir)
129 156
130 157
131 if __name__ == '__main__': 158 if __name__ == '__main__':
132 sys.exit(main()) 159 sys.exit(main())
133 160
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698