OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license | |
3 # that can be found in the LICENSE file in the root of the source | |
4 # tree. An additional intellectual property rights grant can be found | |
5 # in the file PATENTS. All contributing project authors may | |
6 # be found in the AUTHORS file in the root of the source tree. | |
7 from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice | |
8 | |
9 import string | |
kjellander_webrtc
2016/09/19 05:27:29
Sort imports alphabetically.
Tip: you can run gpy
| |
10 import time | |
11 import random | |
12 import sys | |
13 import subprocess | |
14 | |
15 devname = sys.argv[2] | |
kjellander_webrtc
2016/09/19 05:27:29
Put everything in a main method and invoke it at t
kjellander_webrtc
2016/09/19 05:27:29
Since this is python and managing flags is so easy
mandermo
2016/09/23 15:12:03
Done.
| |
16 | |
17 videoout = sys.argv[3] | |
18 | |
19 room = ''.join(random.choice(string.ascii_letters + string.digits) | |
20 for _ in range(8)) | |
kjellander_webrtc
2016/09/19 05:27:28
-1 space indent.
mandermo
2016/09/23 15:12:03
Done.
| |
21 | |
22 # Delete output video file | |
23 subprocess.Popen(['adb', '-s', devname, 'shell', 'rm', | |
24 '/storage/emulated/0/output.y4m']) | |
kjellander_webrtc
2016/09/19 05:27:29
indent with previous line's parenthesis
https://go
mandermo
2016/09/23 15:12:04
Done.
| |
25 #sys.exit() | |
kjellander_webrtc
2016/09/19 05:27:29
Please remove this debugging line.
mandermo
2016/09/23 15:12:03
Done.
| |
26 | |
27 device = MonkeyRunner.waitForConnection(2, devname) | |
28 | |
29 extras = { | |
30 'org.appspot.apprtc.AUDIOCODEC': 'OPUS', | |
kjellander_webrtc
2016/09/19 05:27:28
Indent these lines with 4 spaces, not more.
mandermo
2016/09/23 15:12:03
Done.
| |
31 'org.appspot.apprtc.LOOPBACK': True, | |
32 'org.appspot.apprtc.VIDEOCODEC': 'VP8', | |
33 'org.appspot.apprtc.CAPTURETOTEXTURE': False, | |
34 'org.appspot.apprtc.CAMERA2': False, | |
35 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA': | |
36 '/storage/emulated/0/nv21_1280x720.yuv', | |
kjellander_webrtc
2016/09/19 05:27:29
Create a flag for this and use this value as the d
mandermo
2016/09/23 15:12:03
Done.
| |
37 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_WIDTH': 1280, | |
kjellander_webrtc
2016/09/19 05:27:29
I'd prefer to extract width and height as paramete
mandermo
2016/09/23 15:12:03
Done.
| |
38 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT': 720, | |
39 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE': | |
40 '/storage/emulated/0/output.y4m', | |
kjellander_webrtc
2016/09/19 05:27:28
Another flag.
mandermo
2016/09/23 15:12:03
Done.
| |
41 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH': 1280, | |
42 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT': 720, | |
43 'org.appspot.apprtc.ROOMID': room} | |
44 | |
45 # ACTION_VIEW is equivalent to android.intent.action.VIEW, | |
46 # see https://developer.android.com/reference/android/content/Intent.html#ACTION _VIEW | |
47 device.startActivity(data='https://appr.tc', action='ACTION_VIEW', | |
kjellander_webrtc
2016/09/19 05:27:29
We want to have a flag for this address as well, s
mandermo
2016/09/23 15:12:04
Will do that in separate CL when we run locally
| |
48 component='org.appspot.apprtc/.CallActivity', extras=extras) | |
kjellander_webrtc
2016/09/19 05:27:29
indent either with 4 spaces or align with the abov
mandermo
2016/09/23 15:12:03
Done.
| |
49 | |
50 time.sleep(10) | |
kjellander_webrtc
2016/09/19 05:27:28
Please add a flag for the call length, then creat
mandermo
2016/09/23 15:12:04
Done.
| |
51 | |
52 # Press back to end the call. Will end on both sides | |
kjellander_webrtc
2016/09/19 05:27:29
nit: End comments with punctation.
| |
53 device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) | |
54 | |
55 subprocess.Popen(['adb', '-s', devname, 'pull', | |
kjellander_webrtc
2016/09/19 05:27:29
Do we know that the call has ended, teardown has c
mandermo
2016/09/23 15:12:04
Not had any problems yet, but added small sleep
| |
56 '/storage/emulated/0/output.y4m', videoout]) | |
kjellander_webrtc
2016/09/19 05:27:29
Use the same flag as earlier here, for the putput
mandermo
2016/09/23 15:12:03
Done.
| |
57 | |
OLD | NEW |