Index: webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
diff --git a/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py b/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c5c8da6e42b7ce82233e3769ac4d6ecda70dc50b |
--- /dev/null |
+++ b/webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py |
@@ -0,0 +1,57 @@ |
+# Copyright 2016 The WebRTC Project Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license |
+# that can be found in the LICENSE file in the root of the source |
+# tree. An additional intellectual property rights grant can be found |
+# in the file PATENTS. All contributing project authors may |
+# be found in the AUTHORS file in the root of the source tree. |
+from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice |
+ |
+import string |
kjellander_webrtc
2016/09/19 05:27:29
Sort imports alphabetically.
Tip: you can run gpy
|
+import time |
+import random |
+import sys |
+import subprocess |
+ |
+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.
|
+ |
+videoout = sys.argv[3] |
+ |
+room = ''.join(random.choice(string.ascii_letters + string.digits) |
+ for _ in range(8)) |
kjellander_webrtc
2016/09/19 05:27:28
-1 space indent.
mandermo
2016/09/23 15:12:03
Done.
|
+ |
+# Delete output video file |
+subprocess.Popen(['adb', '-s', devname, 'shell', 'rm', |
+ '/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.
|
+#sys.exit() |
kjellander_webrtc
2016/09/19 05:27:29
Please remove this debugging line.
mandermo
2016/09/23 15:12:03
Done.
|
+ |
+device = MonkeyRunner.waitForConnection(2, devname) |
+ |
+extras = { |
+ '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.
|
+ 'org.appspot.apprtc.LOOPBACK': True, |
+ 'org.appspot.apprtc.VIDEOCODEC': 'VP8', |
+ 'org.appspot.apprtc.CAPTURETOTEXTURE': False, |
+ 'org.appspot.apprtc.CAMERA2': False, |
+ 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA': |
+ '/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.
|
+ '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.
|
+ 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT': 720, |
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE': |
+ '/storage/emulated/0/output.y4m', |
kjellander_webrtc
2016/09/19 05:27:28
Another flag.
mandermo
2016/09/23 15:12:03
Done.
|
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH': 1280, |
+ 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT': 720, |
+ 'org.appspot.apprtc.ROOMID': room} |
+ |
+# ACTION_VIEW is equivalent to android.intent.action.VIEW, |
+# see https://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW |
+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
|
+ 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.
|
+ |
+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.
|
+ |
+# Press back to end the call. Will end on both sides |
kjellander_webrtc
2016/09/19 05:27:29
nit: End comments with punctation.
|
+device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) |
+ |
+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
|
+ '/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.
|
+ |